diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2019-01-20 16:04:59 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2019-01-20 16:04:59 -0700 |
commit | c9c154f10f7544cd94abe05f9057d92dd6f2324f (patch) | |
tree | 63f161700fc69027ef81d2a1a606ec15fae1f810 /numpy/f2py/tests/test_compile_function.py | |
parent | 568d0f7483f7b94029d49707ccd6371f9f5c554c (diff) | |
download | numpy-c9c154f10f7544cd94abe05f9057d92dd6f2324f.tar.gz |
BUG: Fix testing of f2py.compile from strings.
The test should not be run if there is no Fortran compiler. This PR
moves it to `numpy/f2py/tests/test_compile_function.py`, which is
appropriate for the test and a place where the presence of the needed
compilers is already checked for.
Diffstat (limited to 'numpy/f2py/tests/test_compile_function.py')
-rw-r--r-- | numpy/f2py/tests/test_compile_function.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/numpy/f2py/tests/test_compile_function.py b/numpy/f2py/tests/test_compile_function.py index 74e0804e2..36abf05f9 100644 --- a/numpy/f2py/tests/test_compile_function.py +++ b/numpy/f2py/tests/test_compile_function.py @@ -106,3 +106,20 @@ def test_f2py_init_compile_bad_cmd(): assert_equal(ret_val, 127) finally: sys.executable = temp + + +@pytest.mark.parametrize('fsource', + ['program test_f2py\nend program test_f2py', + b'program test_f2py\nend program test_f2py',]) +def test_compile_from_strings(tmpdir, fsource): + # Make sure we can compile str and bytes gh-12796 + cwd = os.getcwd() + try: + os.chdir(str(tmpdir)) + ret_val = numpy.f2py.compile( + fsource, + modulename='test_compile_from_strings', + extension='.f90') + assert_equal(ret_val, 0) + finally: + os.chdir(cwd) |