summaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests
diff options
context:
space:
mode:
Diffstat (limited to '.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests')
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__init__.py16
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/__init__.cpython-312.pycbin0 -> 568 bytes
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/pyinstaller-smoke.cpython-312.pycbin0 -> 2613 bytes
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/test_pyinstaller.cpython-312.pycbin0 -> 1963 bytes
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py32
-rw-r--r--.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py35
6 files changed, 83 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__init__.py b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__init__.py
new file mode 100644
index 0000000..4ed8fdd
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__init__.py
@@ -0,0 +1,16 @@
+import pytest
+
+from numpy.testing import IS_EDITABLE, IS_WASM
+
+if IS_WASM:
+ pytest.skip(
+ "WASM/Pyodide does not use or support Fortran",
+ allow_module_level=True
+ )
+
+
+if IS_EDITABLE:
+ pytest.skip(
+ "Editable install doesn't support tests with a compile step",
+ allow_module_level=True
+ )
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/__init__.cpython-312.pyc b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/__init__.cpython-312.pyc
new file mode 100644
index 0000000..d3f52af
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/__init__.cpython-312.pyc
Binary files differ
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/pyinstaller-smoke.cpython-312.pyc b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/pyinstaller-smoke.cpython-312.pyc
new file mode 100644
index 0000000..95efbcb
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/pyinstaller-smoke.cpython-312.pyc
Binary files differ
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/test_pyinstaller.cpython-312.pyc b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/test_pyinstaller.cpython-312.pyc
new file mode 100644
index 0000000..3e13f55
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/__pycache__/test_pyinstaller.cpython-312.pyc
Binary files differ
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py
new file mode 100644
index 0000000..eb28070
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/pyinstaller-smoke.py
@@ -0,0 +1,32 @@
+"""A crude *bit of everything* smoke test to verify PyInstaller compatibility.
+
+PyInstaller typically goes wrong by forgetting to package modules, extension
+modules or shared libraries. This script should aim to touch as many of those
+as possible in an attempt to trip a ModuleNotFoundError or a DLL load failure
+due to an uncollected resource. Missing resources are unlikely to lead to
+arithmetic errors so there's generally no need to verify any calculation's
+output - merely that it made it to the end OK. This script should not
+explicitly import any of numpy's submodules as that gives PyInstaller undue
+hints that those submodules exist and should be collected (accessing implicitly
+loaded submodules is OK).
+
+"""
+import numpy as np
+
+a = np.arange(1., 10.).reshape((3, 3)) % 5
+np.linalg.det(a)
+a @ a
+a @ a.T
+np.linalg.inv(a)
+np.sin(np.exp(a))
+np.linalg.svd(a)
+np.linalg.eigh(a)
+
+np.unique(np.random.randint(0, 10, 100))
+np.sort(np.random.uniform(0, 10, 100))
+
+np.fft.fft(np.exp(2j * np.pi * np.arange(8) / 8))
+np.ma.masked_array(np.arange(10), np.random.rand(10) < .5).sum()
+np.polynomial.Legendre([7, 8, 9]).roots()
+
+print("I made it!")
diff --git a/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py
new file mode 100644
index 0000000..a9061da
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/numpy/_pyinstaller/tests/test_pyinstaller.py
@@ -0,0 +1,35 @@
+import subprocess
+from pathlib import Path
+
+import pytest
+
+
+# PyInstaller has been very unproactive about replacing 'imp' with 'importlib'.
+@pytest.mark.filterwarnings('ignore::DeprecationWarning')
+# It also leaks io.BytesIO()s.
+@pytest.mark.filterwarnings('ignore::ResourceWarning')
+@pytest.mark.parametrize("mode", ["--onedir", "--onefile"])
+@pytest.mark.slow
+def test_pyinstaller(mode, tmp_path):
+ """Compile and run pyinstaller-smoke.py using PyInstaller."""
+
+ pyinstaller_cli = pytest.importorskip("PyInstaller.__main__").run
+
+ source = Path(__file__).with_name("pyinstaller-smoke.py").resolve()
+ args = [
+ # Place all generated files in ``tmp_path``.
+ '--workpath', str(tmp_path / "build"),
+ '--distpath', str(tmp_path / "dist"),
+ '--specpath', str(tmp_path),
+ mode,
+ str(source),
+ ]
+ pyinstaller_cli(args)
+
+ if mode == "--onefile":
+ exe = tmp_path / "dist" / source.stem
+ else:
+ exe = tmp_path / "dist" / source.stem / source.stem
+
+ p = subprocess.run([str(exe)], check=True, stdout=subprocess.PIPE)
+ assert p.stdout.strip() == b"I made it!"