Skip to content

Commit

Permalink
Fix some bugs in test workflows (#10)
Browse files Browse the repository at this point in the history
* Fix import order in python test files

* Fix working directories in test workflows

* Fix run command in python test workflows

* Add install of matplotlib to build workflow

* Add compilation of c++ binding in python workflow

* Add installation of pybind11 to workflow

* Change compilation command in workflow

* Looking for "pybind11.h"

* Install the library in test workflow

* Update to python 3.11 for conda workflow

* Update to python 3.10 in conda env

* Update to python 3.11 in conda env

* Trying to fix conda dependencies error

* Fix path in anaconda workflow
  • Loading branch information
sbaldu authored Jan 18, 2024
1 parent 96e8ece commit 203bcde
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .env/test_env.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: test-with-conda
dependencies:
- python==3.8
- python>=3.10
- numpy
- matplotlib
- scikit-learn
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
sudo apt-get install -y doctest
# Sets up Python on the machine with the right version
- name: Compile and run the C++ tests
working-directory: ${{github.workspace}}/CLUEstering/include/test
run: |
cd ./CLUEstering/include/test/ && make
./run_tests.sh
make && ./run_tests.sh
12 changes: 8 additions & 4 deletions .github/workflows/python-package-anaconda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.10"
python-version: "3.11"
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
Expand All @@ -33,7 +33,11 @@ jobs:
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
- name: Install locally
working-directory: ${{github.workspace}}
run: |
pip install .
./tests/run_test.sh
- name: Test with pytest
working-directory: ${{github.workspace}}/tests
run: |
python3 -m pytest ./*.py
9 changes: 8 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,19 @@ jobs:
python -m pip install flake8 pytest
python -m pip install scikit-learn
python -m pip install pandas
python -m pip install matplotlib
python -m pip install pybind11
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Install CLUEstering
working-directory: ${{github.workspace}}
run: |
pip install .
- name: Run tests of the Python library
working-directory: ${{github.workspace}}/tests
run: |
./tests/run_test.sh
python3 -m pytest ./*.py
2 changes: 1 addition & 1 deletion tests/test_blob_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
'''

from filecmp import cmp
import CLUEstering as clue
import numpy as np
import os
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_change_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
'''

from math import pi
import CLUEstering as clue
import numpy as np
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_circles_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
'''

from filecmp import cmp
import CLUEstering as clue
import numpy as np
import os
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_clusterer_equality.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Test that the equality operator for clusterer objects works correctly
'''

import CLUEstering as clue
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_domain_extremes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
'''

from math import pi
import CLUEstering as clue
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_input_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
Testing the algorithm with all the supported input data types
'''

import CLUEstering as clue
import numpy as np
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


def test_read_array_except():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Test of the convolutional kernels
'''

import CLUEstering as clue
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


def test_flat_kernel_except():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_moons_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
'''

from filecmp import cmp
import CLUEstering as clue
import os
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sissa_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
'''

from filecmp import cmp
import CLUEstering as clue
import os
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion tests/test_test_blobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Test the test_blobs function, which produces a set of gaussianely distributed blobs
'''

import CLUEstering as clue
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


def test_except_1():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_toydetector_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
'''

from filecmp import cmp
import CLUEstering as clue
import os
import pandas as pd
import pytest
import sys
sys.path.insert(1, '../CLUEstering/')
import CLUEstering as clue


@pytest.fixture
Expand Down

0 comments on commit 203bcde

Please sign in to comment.