diff mbox series

[meta-python,15/16] python3-time-machine: load pytester plugin for testdir fixture in ptest

Message ID 20260829001108.559544-15-khem.raj@oss.qualcomm.com
State New
Headers show
Series [meta-python,01/16] python3-bleak: fetch git tag with tests/ for ptest instead of PyPI sdist | expand

Commit Message

Khem Raj Aug. 29, 2026, 12:11 a.m. UTC
From: Khem Raj <raj.khem@gmail.com>

test_marker_function/_and_fixture/_class/_module use the "testdir"
fixture, provided by pytest builtin pytester plugin. That plugin is
not autoloaded; upstream pyproject.toml sets addopts = "-p pytester"
but that file is not shipped into the ptest tree, so the fixture is
unavailable and these 4 tests error out (fixture testdir not found).
Pass -p pytester directly in run-ptest.

AI-Generated: Uses Claude Code
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../recipes-devtools/python/python3-time-machine_3.2.0.bb | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-time-machine_3.2.0.bb b/meta-python/recipes-devtools/python/python3-time-machine_3.2.0.bb
index 32d64f8d14..e898a43f99 100644
--- a/meta-python/recipes-devtools/python/python3-time-machine_3.2.0.bb
+++ b/meta-python/recipes-devtools/python/python3-time-machine_3.2.0.bb
@@ -26,7 +26,13 @@  do_install_ptest:append() {
     # instant of a slim tzfile and returns a 0 (UTC) offset, so the epoch maps to
     # 0 instead of 21600. Python's own zoneinfo reads the same file correctly, so
     # this is a dateutil/slim-tzdata limitation, not a time_machine bug.
-    sed -i -e "/--automake/ s|\$| --deselect tests/test_time_machine.py::test_destination_datetime_tzinfo_non_zoneinfo|" \
+    #
+    # test_marker_function/_and_fixture/_class/_module use the "testdir" fixture,
+    # provided by pytest's builtin pytester plugin. That plugin isn't autoloaded;
+    # upstream's pyproject.toml sets [tool.pytest.ini_options] addopts = "-p
+    # pytester", but that file isn't shipped into the ptest tree, so the fixture
+    # is unavailable and those 4 tests error out. Pass -p pytester directly.
+    sed -i -e "/--automake/ s|\$| -p pytester --deselect tests/test_time_machine.py::test_destination_datetime_tzinfo_non_zoneinfo|" \
         ${D}${PTEST_PATH}/run-ptest
 }