From 5c7074f90ee7093f231816cb356cb787e0f22802 Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Fri, 6 Aug 2021 16:24:34 -0600 Subject: Fix the tests for Python 3.7 The array_api submodule needs to be skipped entirely, as it uses non-3.7 compatible syntax. --- numpy/_pytesttester.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'numpy/_pytesttester.py') 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. -- cgit v1.2.1