[pypy-commit] pypy default: Improve the test, which fails on "pypy -A": try repeatedly to get a
arigo
noreply at buildbot.pypy.org
Thu Jul 3 11:40:46 CEST 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r72325:28a1ebabc3e4
Date: 2014-07-03 11:40 +0200
http://bitbucket.org/pypy/pypy/changeset/28a1ebabc3e4/
Log: Improve the test, which fails on "pypy -A": try repeatedly to get a
small array, fill it with garbage, and then free it. It's likely we
end up at the same location with still the garbage.
diff --git a/pypy/module/micronumpy/test/test_arrayops.py b/pypy/module/micronumpy/test/test_arrayops.py
--- a/pypy/module/micronumpy/test/test_arrayops.py
+++ b/pypy/module/micronumpy/test/test_arrayops.py
@@ -3,18 +3,27 @@
class AppTestNumSupport(BaseNumpyAppTest):
def test_zeros(self):
- from numpypy import zeros, empty
+ from numpypy import zeros
a = zeros(3)
assert len(a) == 3
assert a[0] == a[1] == a[2] == 0
- a = empty(1000)
- assert len(a) == 1000
+
+ def test_empty(self):
+ from numpypy import empty
+ import gc
for i in range(1000):
- if a[i] != 0:
- break
+ a = empty(3)
+ assert len(a) == 3
+ if not (a[0] == a[1] == a[2] == 0):
+ break # done
+ a[0] = 1.23
+ a[1] = 4.56
+ a[2] = 7.89
+ del a
+ gc.collect()
else:
raise AssertionError(
- "empty() returned a zeroed out array of length 1000 (unlikely)")
+ "empty() returned a zeroed out array every time")
def test_where(self):
from numpypy import where, ones, zeros, array
More information about the pypy-commit
mailing list