MCPcopy Index your code
hub / github.com/numpy/numpy / test_freethreading_compatible

Function test_freethreading_compatible

numpy/f2py/tests/test_f2py2e.py:839–859  ·  view source on GitHub ↗

CLI :: --freethreading_compatible

(hello_world_f90, monkeypatch)

Source from the content-addressed store, hash-verified

837@pytest.mark.skipif((platform.system() != 'Linux') or sys.version_info <= (3, 12),
838 reason='Compiler and Python 3.12 or newer required')
839def test_freethreading_compatible(hello_world_f90, monkeypatch):
840 """
841 CLI :: --freethreading_compatible
842 """
843 ipath = Path(hello_world_f90)
844 monkeypatch.setattr(sys, "argv", f'f2py -m blah {ipath} -c --freethreading-compatible'.split())
845
846 with util.switchdir(ipath.parent):
847 compiler_check_f2pycli()
848 cmd = f"{sys.executable} -c \"import blah; blah.hi();"
849 if NOGIL_BUILD:
850 cmd += "import sys; assert sys._is_gil_enabled() is False\""
851 else:
852 cmd += "\""
853 cmd_run = shlex.split(cmd)
854 rout = subprocess.run(cmd_run, capture_output=True, encoding='UTF-8')
855 eout = ' Hello World\n'
856 assert rout.stdout == eout
857 if "LSAN_OPTIONS" not in os.environ:
858 assert rout.stderr == ""
859 assert rout.returncode == 0
860
861
862# Numpy distutils flags

Callers

nothing calls this directly

Calls 3

compiler_check_f2pycliFunction · 0.85
splitMethod · 0.80
runMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…