summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2022-05-06 15:02:58 +0200
committerGitHub <noreply@github.com>2022-05-06 15:02:58 +0200
commit38dec01b7ea36d137e66818f53a5555364f06b4a (patch)
tree20b679511523d0168a42d8e17e31c66ebf56fb6f /numpy
parentbefef7b26773eddd2b656a3ab87f504e6cc173db (diff)
parentaf0c674ec36e46c37ff4b2d4f0ff35a88bfad435 (diff)
downloadnumpy-38dec01b7ea36d137e66818f53a5555364f06b4a.tar.gz
Merge pull request #21411 from HaoZeke/gh15528
MAINT: Remove `f2py.f2py_testing` without replacement
Diffstat (limited to 'numpy')
-rw-r--r--numpy/f2py/__init__.py14
-rw-r--r--numpy/f2py/f2py_testing.py46
-rw-r--r--numpy/tests/test_public_api.py1
3 files changed, 3 insertions, 58 deletions
diff --git a/numpy/f2py/__init__.py b/numpy/f2py/__init__.py
index 15c219ad4..eb8a050a4 100644
--- a/numpy/f2py/__init__.py
+++ b/numpy/f2py/__init__.py
@@ -176,11 +176,7 @@ if sys.version_info[:2] >= (3, 7):
# Avoid importing things that aren't needed for building
# which might import the main numpy module
- if attr == "f2py_testing":
- import numpy.f2py.f2py_testing as f2py_testing
- return f2py_testing
-
- elif attr == "test":
+ if attr == "test":
from numpy._pytesttester import PytestTester
test = PytestTester(__name__)
return test
@@ -190,11 +186,7 @@ if sys.version_info[:2] >= (3, 7):
"{!r}".format(__name__, attr))
def __dir__():
- return list(globals().keys() | {"f2py_testing", "test"})
+ return list(globals().keys() | {"test"})
else:
- from . import f2py_testing
-
- from numpy._pytesttester import PytestTester
- test = PytestTester(__name__)
- del PytestTester
+ raise NotImplementedError("F2PY needs Python 3.7")
diff --git a/numpy/f2py/f2py_testing.py b/numpy/f2py/f2py_testing.py
deleted file mode 100644
index 1f109e67a..000000000
--- a/numpy/f2py/f2py_testing.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import sys
-import re
-
-from numpy.testing import jiffies, memusage
-
-
-def cmdline():
- m = re.compile(r'\A\d+\Z')
- args = []
- repeat = 1
- for a in sys.argv[1:]:
- if m.match(a):
- repeat = eval(a)
- else:
- args.append(a)
- f2py_opts = ' '.join(args)
- return repeat, f2py_opts
-
-
-def run(runtest, test_functions, repeat=1):
- l = [(t, repr(t.__doc__.split('\n')[1].strip())) for t in test_functions]
- start_memusage = memusage()
- diff_memusage = None
- start_jiffies = jiffies()
- i = 0
- while i < repeat:
- i += 1
- for t, fname in l:
- runtest(t)
- if start_memusage is None:
- continue
- if diff_memusage is None:
- diff_memusage = memusage() - start_memusage
- else:
- diff_memusage2 = memusage() - start_memusage
- if diff_memusage2 != diff_memusage:
- print('memory usage change at step %i:' % i,
- diff_memusage2 - diff_memusage,
- fname)
- diff_memusage = diff_memusage2
- current_memusage = memusage()
- print('run', repeat * len(test_functions), 'tests',
- 'in %.2f seconds' % ((jiffies() - start_jiffies) / 100.0))
- if start_memusage:
- print('initial virtual memory size:', start_memusage, 'bytes')
- print('current virtual memory size:', current_memusage, 'bytes')
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py
index 76deb281c..e028488d3 100644
--- a/numpy/tests/test_public_api.py
+++ b/numpy/tests/test_public_api.py
@@ -252,7 +252,6 @@ PRIVATE_BUT_PRESENT_MODULES = ['numpy.' + s for s in [
"f2py.crackfortran",
"f2py.diagnose",
"f2py.f2py2e",
- "f2py.f2py_testing",
"f2py.f90mod_rules",
"f2py.func2subr",
"f2py.rules",