Skip to content

Commit

Permalink
Fix unit tests failing with Numpy 1.24.0 (#759)
Browse files Browse the repository at this point in the history
With the release of Numpy 1.24 on December 18, certain unit tests started failing in Github actions due to lack of accuracy. Unfortunately the issue cannot be reproduced locally, and as such is impossible to debug. Out of caution, this PR excludes Numpy version 1.24 from the dependency range until we have more clarity about the situation.
  • Loading branch information
gertjanvanzwieten committed Dec 19, 2022
2 parents 1c617cf + 0bfd2a3 commit a564365
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
python -um pip install "$_wheel[import_gmsh]"
- name: Install Scipy
if: ${{ matrix.matrix-backend == 'scipy' }}
run: python -um pip install --upgrade --upgrade-strategy eager scipy
run: python -um pip install --upgrade scipy
- name: Configure MKL
if: ${{ matrix.matrix-backend == 'mkl' }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion nutils/numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def inv(A):

isarray = lambda a: isinstance(a, numpy.ndarray)
isboolarray = lambda a: isarray(a) and a.dtype == bool
isbool = lambda a: isboolarray(a) and a.ndim == 0 or type(a) == bool
isbool = lambda a: isboolarray(a) and a.ndim == 0 or isinstance(a, (bool, numpy.bool_))
isint = lambda a: isinstance(a, numbers.Integral)
isnumber = lambda a: isinstance(a, numbers.Number)
isintarray = lambda a: isarray(a) and numpy.issubdtype(a.dtype, numpy.integer)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ requires-python = '~=3.7'
dependencies = [
"appdirs~=1.0",
"bottombar~=2.0.2",
"numpy>=1.17",
"numpy>=1.17,<1.24",
"psutil~=5.0",
"stringly",
"treelog>=1.0b5",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_numeric.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def test_isint(self):

def test_isbool(self):
self.assertTrue(numeric.isbool(True))
self.assertTrue(numeric.isbool(numpy.bool(True)))
self.assertTrue(numeric.isbool(numpy.bool_(True)))
self.assertTrue(numeric.isbool(numpy.array(True)))
self.assertFalse(numeric.isbool(numpy.array([True])))

Expand Down

0 comments on commit a564365

Please sign in to comment.