summaryrefslogtreecommitdiff
path: root/tools/test-installed-numpy.py
diff options
context:
space:
mode:
authornjsmith <njs@pobox.com>2013-04-03 12:05:33 -0700
committernjsmith <njs@pobox.com>2013-04-03 12:05:33 -0700
commit961a28f828fd7075af1e548a294c1443fdf4a215 (patch)
treec0396b912ae789714fe204e862796d6a18bbc929 /tools/test-installed-numpy.py
parenta939f2aa83e7d37d5e35e7c2a8c539c59f682598 (diff)
parent507b09e523e11610ea7f9bf3350b2258120ab0d2 (diff)
downloadnumpy-961a28f828fd7075af1e548a294c1443fdf4a215.tar.gz
Merge pull request #3162 from seberg/unsafe-strides
Revert changes to contiguous flags definition while creating NPY_TEST_UNSAFE_STRIDES
Diffstat (limited to 'tools/test-installed-numpy.py')
-rw-r--r--tools/test-installed-numpy.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/test-installed-numpy.py b/tools/test-installed-numpy.py
index d3c865139..41d64614f 100644
--- a/tools/test-installed-numpy.py
+++ b/tools/test-installed-numpy.py
@@ -12,7 +12,7 @@ from __future__ import division, absolute_import
# But, python2.4's -m switch only works with top-level modules, not modules
# that are inside packages. So, once we drop 2.4 support, maybe...
-import sys
+import sys, os
# In case we are run from the source directory, we don't want to import numpy
# from there, we want to import the installed version:
sys.path.pop(0)
@@ -35,6 +35,17 @@ parser.add_option("-m", "--mode",
(options, args) = parser.parse_args()
import numpy
+
+# Check that NPY_RELAXED_STRIDES_CHECKING is active when set.
+# The same flags check is also used in the tests to switch behavior.
+if (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "0") != "0"):
+ if not numpy.ones((10,1), order='C').flags.f_contiguous:
+ print('NPY_RELAXED_STRIDES_CHECKING set, but not active.')
+ sys.exit(1)
+elif numpy.ones((10,1), order='C').flags.f_contiguous:
+ print('NPY_RELAXED_STRIDES_CHECKING not set, but active.')
+ sys.exit(1)
+
result = numpy.test(options.mode,
verbose=options.verbose,
extra_argv=args,