Skip to content

Commit

Permalink
Merge pull request #28 from matchms/issue_24
Browse files Browse the repository at this point in the history
Switch from prospector to ruff
  • Loading branch information
florian-huber authored Nov 21, 2024
2 parents f70fbc3 + 2401d9a commit 18f8889
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 34 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/CI_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ on:
jobs:

first_check:
name: first code check / python-3.10 / ubuntu-latest
name: first code check / python-3.12 / ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
- name: Python info
run: |
which python
Expand All @@ -32,16 +32,14 @@ jobs:
poetry lock
poetry install --with dev
- name: Show pip list
run: |
pip list
run: poetry run pip list
- name: Test with coverage
run: |
poetry run pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
- name: Correct coverage paths
run: sed -i "s+$PWD/++g" coverage.xml
- name: Check style against standards using prospector
shell: bash -l {0}
run: poetry run prospector -o grouped -o pylint:pylint-report.txt
- name: Check style against standards using Ruff
run: poetry run ruff check .
- name: Check whether import statements are used consistently
run: poetry run isort . --check-only --diff

Expand All @@ -51,10 +49,10 @@ jobs:
needs: first_check
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
- name: Python info
run: |
which python
Expand All @@ -79,7 +77,7 @@ jobs:
poetry install
- name: Show pip list again
run: |
pip list
poetry run pip list
- name: Run tests
run: |
poetry run pytest
Expand Down Expand Up @@ -114,7 +112,7 @@ jobs:
poetry install
- name: Show pip list
run: |
pip list
poetry run pip list
- name: Run tests
run: |
poetry run pytest
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pytest = "^8.3.3"
pytest-cov = "^6.0.0"
yapf = "^0.40.2"
testfixtures = "^8.3.0"
prospector = "^1.12.1"
poetry-bumpversion = "^0.3.2"
ruff = ">0.7"

[build-system]
requires = ["poetry-core"]
Expand Down
21 changes: 0 additions & 21 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,27 +45,6 @@ def test_join_arrays_join_types(join_type, expected_data, expected_row):
assert np.allclose(row, expected_row)


@pytest.mark.parametrize("join_type, expected_data, expected_row", [
["left", np.array([[0, 0], [1, 0], [2, 2], [4, 0], [5, 5]]), np.array([0, 1, 2, 4, 5])],
["right", np.array([[2, 2],[0, 3], [5, 5], [0, 6], [0, 7],]), np.array([2, 3, 5, 6, 7])],
["inner", np.array([[2, 2], [5, 5]]), np.array([2, 5])],
["outer", np.array([[0, 0], [1, 0], [2, 2], [0, 3], [4, 0], [5, 5], [0, 6], [0, 7]]),
np.array([0, 1, 2, 3, 4, 5, 6, 7])],
])
def test_join_arrays_join_types(join_type, expected_data, expected_row):
row1 = np.array([0, 1, 2, 4, 5])
col1 = np.array([0, 1, 2, 4, 5])
row2 = np.array([7, 5, 3, 6, 2])
col2 = np.array([7, 5, 3, 6, 2])
data1 = np.array(col1, dtype=[("layer1", col1.dtype)])
data2 = np.array(col2, dtype=[("layer2", col2.dtype)])

row, col, data = join_arrays(row1, col1, data1, row2, col2, data2, "test1",
join_type=join_type)
assert np.allclose(np.array([[x[0], x[1]] for x in data]), expected_data)
assert np.allclose(row, expected_row)


@pytest.mark.parametrize("join_type", [
"left", "right", "inner", "outer"
])
Expand Down

0 comments on commit 18f8889

Please sign in to comment.