summaryrefslogtreecommitdiff
path: root/numpy/lib/tests
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2020-03-18 23:53:09 +0200
committerGitHub <noreply@github.com>2020-03-18 23:53:09 +0200
commit965b41d418e6100c1afae0b6f818a7ef152bc25d (patch)
tree0e31074466dd881a08c4a26de424362e035d9a53 /numpy/lib/tests
parentc2dd245047ff2eb80972600163ecac9048d74e1f (diff)
downloadnumpy-965b41d418e6100c1afae0b6f818a7ef152bc25d.tar.gz
BUG, TST: fix f2py for PyPy, skip one test for PyPy (#15750)
* BUG, TST: fix f2py for PyPy, skip one test for PyPy, xfail tests for s390x
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r--numpy/lib/tests/test_io.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/numpy/lib/tests/test_io.py b/numpy/lib/tests/test_io.py
index db9f35f2a..6812d8d68 100644
--- a/numpy/lib/tests/test_io.py
+++ b/numpy/lib/tests/test_io.py
@@ -1,4 +1,5 @@
import sys
+import gc
import gzip
import os
import threading
@@ -276,8 +277,6 @@ class TestSavezLoad(RoundtripTest):
fp.seek(0)
assert_(not fp.closed)
- #FIXME: Is this still true?
- @pytest.mark.skipif(IS_PYPY, reason="Missing context manager on PyPy")
def test_closing_fid(self):
# Test that issue #1517 (too many opened files) remains closed
# It might be a "weak" test since failed to get triggered on
@@ -290,17 +289,18 @@ class TestSavezLoad(RoundtripTest):
# numpy npz file returned by np.load when their reference count
# goes to zero. Python 3 running in debug mode raises a
# ResourceWarning when file closing is left to the garbage
- # collector, so we catch the warnings. Because ResourceWarning
- # is unknown in Python < 3.x, we take the easy way out and
- # catch all warnings.
+ # collector, so we catch the warnings.
with suppress_warnings() as sup:
- sup.filter(Warning) # TODO: specify exact message
+ sup.filter(ResourceWarning) # TODO: specify exact message
for i in range(1, 1025):
try:
np.load(tmp)["data"]
except Exception as e:
msg = "Failed to load data from a file: %s" % e
raise AssertionError(msg)
+ finally:
+ if IS_PYPY:
+ gc.collect()
def test_closing_zipfile_after_load(self):
# Check that zipfile owns file and can close it. This needs to
@@ -568,8 +568,9 @@ class TestSaveTxt:
else:
assert_equal(s.read(), b"%f\n" % 1.)
- @pytest.mark.skipif(sys.platform=='win32',
- reason="large files cause problems")
+ @pytest.mark.skipif(sys.platform=='win32', reason="files>4GB may not work")
+ @pytest.mark.skipif(IS_PYPY,
+ reason="GC problems after test, gc.collect does not help. see gh-15775")
@pytest.mark.slow
@requires_memory(free_bytes=7e9)
def test_large_zip(self):