Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 507b09e

Browse files
committed
TST: Add NPY_RELAXED_STRIDES_CHECKING to Travis
1 parent 7af1c67 commit 507b09e

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ matrix:
1010
include:
1111
- python: 2.7
1212
env: NPY_SEPARATE_COMPILATION=0
13-
- python: 3.2
13+
- python: 3.3
1414
env: NPY_SEPARATE_COMPILATION=0
15+
- python: 2.7
16+
env: NPY_RELAXED_STRIDES_CHECKING=1
17+
- python: 3.3
18+
env: NPY_RELAXED_STRIDES_CHECKING=1
1519
before_install:
1620
- uname -a
1721
- free -m

tools/test-installed-numpy.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# But, python2.4's -m switch only works with top-level modules, not modules
1313
# that are inside packages. So, once we drop 2.4 support, maybe...
1414

15-
import sys
15+
import sys, os
1616
# In case we are run from the source directory, we don't want to import numpy
1717
# from there, we want to import the installed version:
1818
sys.path.pop(0)
@@ -35,6 +35,17 @@
3535
(options, args) = parser.parse_args()
3636

3737
import numpy
38+
39+
# Check that NPY_RELAXED_STRIDES_CHECKING is active when set.
40+
# The same flags check is also used in the tests to switch behavior.
41+
if (os.environ.get('NPY_RELAXED_STRIDES_CHECKING', "0") != "0"):
42+
if not numpy.ones((10,1), order='C').flags.f_contiguous:
43+
print('NPY_RELAXED_STRIDES_CHECKING set, but not active.')
44+
sys.exit(1)
45+
elif numpy.ones((10,1), order='C').flags.f_contiguous:
46+
print('NPY_RELAXED_STRIDES_CHECKING not set, but active.')
47+
sys.exit(1)
48+
3849
result = numpy.test(options.mode,
3950
verbose=options.verbose,
4051
extra_argv=args,

0 commit comments

Comments
 (0)