8000 DEV/TST: print relevant env vars values in test header · Issue #23030 · scipy/scipy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

DEV/TST: print relevant env vars values in test header #23030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ev-br opened this issue May 21, 2025 · 1 comment
Open

DEV/TST: print relevant env vars values in test header #23030

ev-br opened this issue May 21, 2025 · 1 comment
Labels
DX Everything related to making the experience of working on SciPy more pleasant maintenance Items related to regular maintenance tasks

Comments

@ev-br
Copy link
Member
ev-br commented May 21, 2025

continued from #22980 (comment)

spin test prints useful information in the header, including the precise python/shell commands it executes. What this header does not include though, are values of relevant environment variables: $ SCIPY_DEFAULT_DTYPE=float32 spin test will not show the value of SCIPY_DEFAULT_DTYPE.

We can fix this by adding a pytest_report_header hook can add arbitrary information to the report header (a demo is under the fold).

For instance, this diff

$ git diff
diff --git a/scipy/conftest.py b/scipy/conftest.py
index 1ed736a2d3..6cbc6fdbe7 100644
--- a/scipy/conftest.py
+++ b/scipy/conftest.py
@@ -33,6 +33,11 @@ except Exception:
     PARALLEL_RUN_AVAILABLE = False
 
 
+def pytest_report_header(config):
+    s = 'ADDITIONAL CONFIG'
+    return s
+
+
 def pytest_configure(config):
     try:
         import pytest_timeout  # noqa:F401

produces (note an ADDITIONAL CONFIG just below "platform linux")

$ spin test scipy/signal/tests/test_splines.py::test_ 
Invoking `build` prior to running tests:
$ meson compile -j 4 -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /home/br/miniforge3/envs/scipy-dev/bin/ninja -C /home/br/repos/scipy/scipy/build -j 4
ninja: Entering directory `/home/br/repos/scipy/scipy/build'
[2/338] Generating subprojects/highs/src/HConfig.h with a custom command
$ meson install --only-changed -C build --destdir ../build-install --tags=runtime,python-runtime,tests,devel
$ export PYTHONPATH="/home/br/repos/scipy/scipy/build-install/usr/lib/python3.12/site-packages"
$ /home/br/miniforge3/envs/scipy-dev/bin/python3.12 -P -c 'import scipy'
$ cd /home/br/repos/scipy/scipy/build-install/usr/lib/python3.12/site-packages
$ /home/br/miniforge3/envs/scipy-dev/bin/python3.12 -P -m pytest -m 'not slow' scipy/signal/tests/test_splines.py::test_ -s
======================================= test session starts ========================================
platform linux -- Python 3.12.8, pytest-8.3.4, pluggy-1.5.0
ADDITIONAL CONFIG
rootdir: /home/br/repos/scipy/scipy
configfile: pytest.ini
plugins: profiling-1.8.1, json-report-1.5.0, hypothesis-6.125.1, xdist-3.6.1, anyio-4.8.0, cov-6.0.0, timeout-2.3.1, doctestplus-1.4.0, metadata-3.1.1
collected 0 items                                                                                  

====================================== no tests ran in 0.51s =======================================
ERROR: not found: /home/br/repos/scipy/scipy/build-install/usr/lib/python3.12/site-packages/scipy/signal/tests/test_splines.py::test_
(no match in any of [<Module test_splines.py>])

I'm not sure what makes Highs this very special so that we're regenerating something named HConfig.h on each test run, but that's separate anyway.

@ev-br ev-br added enhancement A new feature or improvement DX Everything related to making the experience of working on SciPy more pleasant labels May 21, 2025
@rgommers
Copy link
Member

Thanks @ev-br. Sounds like a good idea

I'm not sure what makes Highs this very special so that we're regenerating something named HConfig.h on each test run, but that's separate anyway.

The same as the other file that always regenerates: running git for an up-to-date version string.

@lucascolley lucascolley removed the enhancement A new feature or improvement label May 21, 2025
@lucascolley lucascolley changed the title Print out the values of relevant environment variables in the test header DEV/TST: print out the values of relevant environment variables in the test header May 21, 2025
@lucascolley lucascolley changed the title DEV/TST: print out the values of relevant environment variables in the test header DEV/TST: print relevant env vars values in test header May 21, 2025
@lucascolley lucascolley added the maintenance Items related to regular maintenance tasks label May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Everything related to making the experience of working on SciPy more pleasant maintenance Items related to regular maintenance tasks
Projects
None yet
Development

No branches or pull requests

3 participants
0