| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Python312/Lib/site-packages/numpy/tests/ |
Upload File : |
import os
import subprocess
import sysconfig
import pytest
import numpy as np
from numpy.testing import IS_WASM
is_editable = not bool(np.__path__)
numpy_in_sitepackages = sysconfig.get_path('platlib') in np.__file__
# We only expect to have a `numpy-config` available if NumPy was installed via
# a build frontend (and not `spin` for example)
if not (numpy_in_sitepackages or is_editable):
pytest.skip("`numpy-config` not expected to be installed",
allow_module_level=True)
def check_numpyconfig(arg):
p = subprocess.run(['numpy-config', arg], capture_output=True, text=True)
p.check_returncode()
return p.stdout.strip()
@pytest.mark.skipif(IS_WASM, reason="wasm interpreter cannot start subprocess")
def test_configtool_version():
stdout = check_numpyconfig('--version')
assert stdout == np.__version__
@pytest.mark.skipif(IS_WASM, reason="wasm interpreter cannot start subprocess")
def test_configtool_cflags():
stdout = check_numpyconfig('--cflags')
assert stdout.endswith(os.path.join('numpy', '_core', 'include'))
@pytest.mark.skipif(IS_WASM, reason="wasm interpreter cannot start subprocess")
def test_configtool_pkgconfigdir():
stdout = check_numpyconfig('--pkgconfigdir')
assert stdout.endswith(os.path.join('numpy', '_core', 'lib', 'pkgconfig'))
if not is_editable:
# Also check that the .pc file actually exists (unless we're using an
# editable install, then it'll be hiding in the build dir)
assert os.path.exists(os.path.join(stdout, 'numpy.pc'))