summaryrefslogtreecommitdiff
path: root/numpy/_pytesttester.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-08-06 16:24:34 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-08-06 16:24:34 -0600
commit5c7074f90ee7093f231816cb356cb787e0f22802 (patch)
treea642faad77ba6f26b658968188af017664cae1ab /numpy/_pytesttester.py
parentb6f71c8fc742e09d803c99fe41c06d6f2a81d4de (diff)
downloadnumpy-5c7074f90ee7093f231816cb356cb787e0f22802.tar.gz
Fix the tests for Python 3.7
The array_api submodule needs to be skipped entirely, as it uses non-3.7 compatible syntax.
Diffstat (limited to 'numpy/_pytesttester.py')
-rw-r--r--numpy/_pytesttester.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py
index bfcbd4f1f..1e24f75a7 100644
--- a/numpy/_pytesttester.py
+++ b/numpy/_pytesttester.py
@@ -144,12 +144,18 @@ class PytestTester:
# so fetch module for suppression here.
from numpy.distutils import cpuinfo
- # Ignore the warning from importing the array_api submodule. This
- # warning is done on import, so it would break pytest collection,
- # but importing it early here prevents the warning from being
- # issued when it imported again.
- warnings.simplefilter("ignore")
- import numpy.array_api
+ if sys.version_info >= (3, 8):
+ # Ignore the warning from importing the array_api submodule. This
+ # warning is done on import, so it would break pytest collection,
+ # but importing it early here prevents the warning from being
+ # issued when it imported again.
+ warnings.simplefilter("ignore")
+ import numpy.array_api
+ else:
+ # The array_api submodule is Python 3.8+ only due to the use
+ # of positional-only argument syntax. We have to ignore it
+ # completely or the tests will fail at the collection stage.
+ pytest_args += ['--ignore-glob=numpy/array_api/*']
# Filter out annoying import messages. Want these in both develop and
# release mode.