8000 TST: test f2py, fallback on f2py2.7 etc., fixes #6718 · charris/numpy@6f7b32f · GitHub
[go: up one dir, main page]

Skip to content

Commit 6f7b32f

Browse files
joernheescharris
authored andcommitted
TST: test f2py, fallback on f2py2.7 etc., fixes numpy#6718
1 parent 5734bba commit 6f7b32f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

numpy/tests/test_scripts.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from numpy.compat.py3k import basestring, asbytes
1313
from nose.tools import assert_equal
1414
from numpy.testing.decorators import skipif
15+
from numpy.testing import assert_
1516

1617
skipif_inplace = skipif(isfile(pathjoin(dirname(np.__file__), '..', 'setup.py')))
1718

@@ -63,7 +64,18 @@ def test_f2py():
6364
if sys.platform == 'win32':
6465
f2py_cmd = r"%s\Scripts\f2py.py" % dirname(sys.executable)
6566
code, stdout, stderr = run_command([sys.executable, f2py_cmd, '-v'])
67+
assert_equal(stdout.strip(), asbytes('2'))
6668
else:
67-
f2py_cmd = 'f2py' + basename(sys.executable)[6:]
68-
code, stdout, stderr = run_command([f2py_cmd, '-v'])
69-
assert_equal(stdout.strip(), asbytes('2'))
69+
# unclear what f2py cmd was installed as, check plain (f2py) and
70+
# current python version specific one (f2py3.4)
71+
f2py_cmds = ['f2py', 'f2py' + basename(sys.executable)[6:]]
72+
success = False
73+
for f2py_cmd in f2py_cmds:
74+
try:
75+
code, stdout, stderr = run_command([f2py_cmd, '-v'])
76+
assert_equal(stdout.strip(), asbytes('2'))
77+
success = True
78+
break
79+
except FileNotFoundError:
80+
pass
81+
assert_(success, "wasn't able to find f2py or %s on commandline" % f2py_cmds[1])

0 commit comments

Comments
 (0)
0