Skip to content

Commit

Permalink
Exclude new numpy from tests with old python
Browse files Browse the repository at this point in the history
  • Loading branch information
robamler committed Aug 31, 2024
1 parent 2cbb345 commit d56636f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ jobs:
- name: Build Python package
run: poetry run maturin develop --release --features pybindings

- name: pytest with numpy version 1.26
- name: pytest with numpy version 1.x
shell: bash
run: |
poetry run python -m pip install numpy~=1.26
poetry run python -m pip install numpy~=1.16
INSTALLED_NUMPY_VERSION=$(poetry run python -c 'import numpy; print(numpy.__version__)')
echo "Installed numpy version: $INSTALLED_NUMPY_VERSION"
if [ "x${INSTALLED_NUMPY_VERSION:0:5}y" == "x1.26.y" ]; then
if [ "x${INSTALLED_NUMPY_VERSION:0:2}y" == "x1.y" ]; then
echo "Numpy version matches expectation."
else
echo "ERROR: wrong numpy version."
Expand All @@ -163,6 +163,7 @@ jobs:
fi
- name: pytest with numpy version 2.x
if: matrix.python-version != '3.8' && matrix.python-version != '3.9'
shell: bash
run: |
poetry run python -m pip install numpy~=2.1
Expand All @@ -178,6 +179,7 @@ jobs:
exit ${PIPESTATUS[0]}
- name: Verify that pytest used correct python version
if: matrix.python-version != '3.8' && matrix.python-version != '3.9'
shell: bash
run: |
USED_PYTHON_VERSION=$(grep -A1 -iE '^=+ test session starts =+$' pytest-numpy2.out | perl -ne 'if ($_ =~ / -- Python (\d+\.\d+)\.\d+/i) { print "$1"; }')
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ jobs:
- name: Build Python package
run: poetry run maturin develop --release --features pybindings

- name: pytest with numpy version 1.26
- name: pytest with numpy version 1.x
shell: bash
run: |
poetry run python -m pip install numpy~=1.26
poetry run python -m pip install numpy~=1.16
INSTALLED_NUMPY_VERSION=$(poetry run python -c 'import numpy; print(numpy.__version__)')
echo "Installed numpy version: $INSTALLED_NUMPY_VERSION"
if [ "x${INSTALLED_NUMPY_VERSION:0:5}y" == "x1.26.y" ]; then
if [ "x${INSTALLED_NUMPY_VERSION:0:2}y" == "x1.y" ]; then
echo "Numpy version matches expectation."
else
echo "ERROR: wrong numpy version."
Expand All @@ -202,6 +202,7 @@ jobs:
fi
- name: pytest with numpy version 2.x
if: matrix.python-version != '3.8' && matrix.python-version != '3.9'
shell: bash
run: |
poetry run python -m pip install numpy~=2.1
Expand All @@ -217,6 +218,7 @@ jobs:
exit ${PIPESTATUS[0]}
- name: Verify that pytest used correct python version
if: matrix.python-version != '3.8' && matrix.python-version != '3.9'
shell: bash
run: |
USED_PYTHON_VERSION=$(grep -A1 -iE '^=+ test session starts =+$' pytest-numpy2.out | perl -ne 'if ($_ =~ / -- Python (\d+\.\d+)\.\d+/i) { print "$1"; }')
Expand Down

0 comments on commit d56636f

Please sign in to comment.