python3-numpy: set '--rootdir' in run-ptest
PATCH 1/1 python3-numpy: set '--rootdir' in run-ptest
pytest looks for a common rootdir between the current working directory and the args provided[1], which in our case is /usr/lib:
|platform linux -- Python 3.15.2, pytest-9.2.0, pluggy-1.7.0 |rootdir: /usr/lib |plugins: putao-0.4, hypothesis-6.170.12 |collected 2741 items
Specifying '--rootdir=@PYTHON_SITEPACKAGES_DIR@' changes it to the actual numpy directory where the test suites live. This significantly improves ptest runtime, without changing the test results. Examples:
qemux86-64 without patch:
|============================================================================ |Testsuite summary |# TOTAL: 48757 |# PASS: 47548 |# SKIP: 1176 |# XFAIL: 31 |# FAIL: 0 |# XPASS: 2 |# ERROR: 0 |DURATION: 184 |END: /usr/lib/python3-numpy/ptest |2026-11-20T16:54 |STOP: ptest-runner |TOTAL: 1 FAIL: 0
and with patch:
|============================================================================ |Testsuite summary |# TOTAL: 48757 |# PASS: 47548 |# SKIP: 1176 |# XFAIL: 31 |# FAIL: 0 |# XPASS: 2 |# ERROR: 0 |DURATION: 149 |END: /usr/lib/python3-numpy/ptest |2026-11-20T17:15 |STOP: ptest-runner |TOTAL: 1 FAIL: 0
[1]: https://docs.pytest.org/en/stable/reference/customize.html#finding-the-rootdir
Signed-off-by Trevor Gamblin <[email protected]>
--- meta/recipes-devtools/python/python3-numpy/run-ptest | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
meta/recipes-devtools/python/python3-numpy/run-ptest +5 -2
@@ -12,6 +12,9 @@ mkdir -p "$PYTEST_DEBUG_TEMPROOT" # include gcc as a ptest dependency, so skip that. test_big_arrays uses up a # large amount of storage, so skip that too. # remove test_validate_transcendentals if -# https://github.com/numpy/numpy/issues/27460 is resolved -pytest --automake -m "not slow" -k "not test_mem_policy and not test_big_arrays and not test_validate_transcendentals" @PYTHON_SITEPACKAGES_DIR@/numpy +# https://github.com/numpy/numpy/issues/27460 is resolved. +# Set the rootdir explicitly so that pytest doesn't use a common ancestor of the +# ptest directory and test path for it, which slows down the ptest suite's +# runtime +pytest --automake --rootdir=@PYTHON_SITEPACKAGES_DIR@ -m "not slow" -k "not test_mem_policy and not test_big_arrays and not test_validate_transcendentals" @PYTHON_SITEPACKAGES_DIR@/numpy rm -rf "$PYTEST_DEBUG_TEMPROOT"
Signature · 1 line
2.56.0