diff --git a/.gitattributes b/.gitattributes index 9a0e78a75d2e..a7807beb597c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -54,7 +54,6 @@ numpy/version.py linguist-generated # F2py ./doc/source/f2py/*.pyf text ./doc/source/f2py/*.dat text -./numpy/f2py/tests/src/module_data/mod.mod binary # Documents *.md text diff=markdown diff --git a/.gitignore b/.gitignore index 462a0cfb66f0..109a3c49e543 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ GTAGS *.o.d *.py[ocd] *.so +*.mod # Packages # ############ diff --git a/numpy/f2py/tests/src/module_data/mod.mod b/numpy/f2py/tests/src/module_data/mod.mod deleted file mode 100644 index 8670a97e911c..000000000000 Binary files a/numpy/f2py/tests/src/module_data/mod.mod and /dev/null differ diff --git a/numpy/f2py/tests/src/regression/gh25337/data.f90 b/numpy/f2py/tests/src/modules/gh25337/data.f90 similarity index 100% rename from numpy/f2py/tests/src/regression/gh25337/data.f90 rename to numpy/f2py/tests/src/modules/gh25337/data.f90 diff --git a/numpy/f2py/tests/src/regression/gh25337/use_data.f90 b/numpy/f2py/tests/src/modules/gh25337/use_data.f90 similarity index 100% rename from numpy/f2py/tests/src/regression/gh25337/use_data.f90 rename to numpy/f2py/tests/src/modules/gh25337/use_data.f90 diff --git a/numpy/f2py/tests/src/module_data/module_data_docstring.f90 b/numpy/f2py/tests/src/modules/module_data_docstring.f90 similarity index 100% rename from numpy/f2py/tests/src/module_data/module_data_docstring.f90 rename to numpy/f2py/tests/src/modules/module_data_docstring.f90 diff --git a/numpy/f2py/tests/test_module_doc.py b/numpy/f2py/tests/test_module_doc.py deleted file mode 100644 index a7132bf46bc3..000000000000 --- a/numpy/f2py/tests/test_module_doc.py +++ /dev/null @@ -1,28 +0,0 @@ -import os -import sys -import pytest -import textwrap - -from . import util -from numpy.testing import IS_PYPY - - -@pytest.mark.slow -class TestModuleDocString(util.F2PyTest): - sources = [ - util.getpath("tests", "src", "module_data", - "module_data_docstring.f90") - ] - - @pytest.mark.skipif(sys.platform == "win32", - reason="Fails with MinGW64 Gfortran (Issue #9673)") - @pytest.mark.xfail(IS_PYPY, - reason="PyPy cannot modify tp_doc after PyType_Ready") - def test_module_docstring(self): - assert self.module.mod.__doc__ == textwrap.dedent("""\ - i : 'i'-scalar - x : 'i'-array(4) - a : 'f'-array(2,3) - b : 'f'-array(-1,-1), not allocated\x00 - foo()\n - Wrapper for ``foo``.\n\n""") diff --git a/numpy/f2py/tests/test_modules.py b/numpy/f2py/tests/test_modules.py new file mode 100644 index 000000000000..c04320cdbcf5 --- /dev/null +++ b/numpy/f2py/tests/test_modules.py @@ -0,0 +1,35 @@ +import pytest +import textwrap + +from . import util +from numpy.testing import IS_PYPY + + +@pytest.mark.slow +class TestModuleDocString(util.F2PyTest): + sources = [util.getpath("tests", "src", "modules", "module_data_docstring.f90")] + + @pytest.mark.xfail(IS_PYPY, reason="PyPy cannot modify tp_doc after PyType_Ready") + def test_module_docstring(self): + assert self.module.mod.__doc__ == textwrap.dedent( + """\ + i : 'i'-scalar + x : 'i'-array(4) + a : 'f'-array(2,3) + b : 'f'-array(-1,-1), not allocated\x00 + foo()\n + Wrapper for ``foo``.\n\n""" + ) + + +@pytest.mark.slow +class TestModuleAndSubroutine(util.F2PyTest): + module_name = "example" + sources = [ + util.getpath("tests", "src", "modules", "gh25337", "data.f90"), + util.getpath("tests", "src", "modules", "gh25337", "use_data.f90"), + ] + + def test_gh25337(self): + self.module.data.set_shift(3) + assert "data" in dir(self.module) diff --git a/numpy/f2py/tests/test_regression.py b/numpy/f2py/tests/test_regression.py index f67c1f2596c3..c0a8045d91b9 100644 --- a/numpy/f2py/tests/test_regression.py +++ b/numpy/f2py/tests/test_regression.py @@ -66,17 +66,6 @@ def test_include_path(): assert fname in fnames_in_dir -class TestModuleAndSubroutine(util.F2PyTest): - module_name = "example" - sources = [util.getpath("tests", "src", "regression", "gh25337", "data.f90"), - util.getpath("tests", "src", "regression", "gh25337", "use_data.f90")] - - @pytest.mark.slow - def test_gh25337(self): - self.module.data.set_shift(3) - assert "data" in dir(self.module) - - class TestIncludeFiles(util.F2PyTest): sources = [util.getpath("tests", "src", "regression", "incfile.f90")] options = [f"-I{util.getpath('tests', 'src', 'regression')}",