Skip to contentSkip to conversation

python3-cbor2: add tzdata/zoneinfo RDEPENDS for ptest

PATCH New Khem Raj 1 participant 12 messages Aug 16

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/12 python3-cbor2: add tzdata/zoneinfo RDEPENDS for ptest

From: Khem Raj <[email protected]>

Tests exercise zoneinfo-based timezones; add python3-tzdata and python3-zoneinfo to RDEPENDS:${PN}-ptest.

---
 meta-python/recipes-devtools/python/python3-cbor2_6.1.4.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-cbor2_6.1.4.bb +2 -0
index d7f08c6cbc..4074ccb29d 100644
@@ -13,7 +13,9 @@ require ${BPN}-crates.inc
 
 RDEPENDS:${PN}-ptest += " \
     python3-hypothesis \
+    python3-tzdata \
     python3-unixadmin \
+    python3-zoneinfo \
 "
 RDEPENDS:${PN} += " \
     python3-datetime \
author
#1 lore raw

PATCH 2/12 python3-faker: add codecs/misc RDEPENDS for ptest

From: Khem Raj <[email protected]>

Needed by faker's ptest suite.

---
 meta-python/recipes-devtools/python/python3-faker_40.36.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-faker_40.36.0.bb +2 -0
index 196a8f6357..f0d0207a23 100644
@@ -36,7 +36,9 @@ RDEPENDS:${PN} += "\
     "
 
 RDEPENDS:${PN}-ptest += "\
+    python3-codecs \
     python3-freezegun \
+    python3-misc \
     python3-validators \
 "
 
author
#2 lore raw

PATCH 3/12 python3-ecdsa: deselect test with upstream PEM-fixture bug

In reply to Khem Raj

From: Khem Raj <[email protected]>

test_SigningKey_from_pem_pkcs8v2_EdDSA embeds its PEM fixture as an indented triple-quoted string, but der.unpem() only recognizes "-----BEGIN/END-----" markers with no leading whitespace; the indented END marker gets swallowed into the base64 payload instead of being stripped, so it fails with "Incorrect padding" regardless of environment. Upstream test-authoring bug in 0.19.2, not a packaging issue.

---
 meta-python/recipes-devtools/python/python3-ecdsa_0.19.2.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-python/recipes-devtools/python/python3-ecdsa_0.19.2.bb +2 -0
index 5bb1da85b6..59774a1681 100644
@@ -17,6 +17,8 @@ RDEPENDS:${PN}-ptest += " \
 do_install_ptest:append () {
 	install -d ${D}${PTEST_PATH}/tests
 	cp -rf ${S}/src/ecdsa/* ${D}${PTEST_PATH}/tests/
+	sed -i -e "/--automake/ s/$/ -k 'not test_SigningKey_from_pem_pkcs8v2_EdDSA'/" \
+		${D}${PTEST_PATH}/run-ptest
 }
 
 RDEPENDS:${PN} += " \
author
#3 lore raw

PATCH 4/12 python3-fastapi: ship docs_src for ptest, drop pydantic-settings-only examples

In reply to Khem Raj

From: Khem Raj <[email protected]>

Copy docs_src into the ptest tree since scripts/tests import docs_src.*. Remove the two settings examples that require python3-pydantic-settings, which meta-openembedded doesn't package.

---
 .../recipes-devtools/python/python3-fastapi_0.141.1.bb       | 5 +++++
 1 file changed, 5 insertions(+)
meta-python/recipes-devtools/python/python3-fastapi_0.141.1.bb +5 -0
index d26a0ff070..38a691953c 100644
@@ -42,5 +42,10 @@ do_install_ptest:append() {
     install -d ${D}${PTEST_PATH}/scripts
     cp -rf ${S}/scripts/* ${D}${PTEST_PATH}/scripts/
     rm -rf ${D}${PTEST_PATH}/scripts/tests
+    cp -rf ${S}/docs_src ${D}${PTEST_PATH}/
     echo "import sys; from pathlib import Path; sys.path.insert(0, str(Path(__file__).parent))" > ${D}${PTEST_PATH}/conftest.py
+    # these docs examples need python3-pydantic-settings, which meta-python
+    # doesn't package
+    rm -rf ${D}${PTEST_PATH}/docs_src/settings/app02_an_py310
+    rm -rf ${D}${PTEST_PATH}/docs_src/settings/app02_py310
 }
author
#4 lore raw

PATCH 5/12 python3-glances: fix ptest args being consumed by GlancesMain's argv slicing

In reply to Khem Raj

From: Khem Raj <[email protected]>

tests/test_core.py does GlancesMain(args_begin_at=2) at module import time, slicing the real process sys.argv. Passing --automake on the pytest command line (rather than via PYTEST_ADDOPTS) shifted that slice and broke it; set it via PYTEST_ADDOPTS instead.

---
 .../recipes-devtools/python/python3-glances/run-ptest        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-glances/run-ptest +4 -1
index f56ca03dca..5903768942 100644
@@ -1,3 +1,6 @@
 #!/bin/sh
 
-pytest tests/test_core.py
+# test_core.py does `GlancesMain(args_begin_at=2)` at module import time,
+# slicing the real process sys.argv; passing --automake on the command line
+# (rather than via PYTEST_ADDOPTS) shifts that slice and breaks it.
+PYTEST_ADDOPTS="--automake" pytest tests/test_core.py
author
#5 lore raw

PATCH 6/12 python3-google-auth-oauthlib: add python3-cryptography to ptest RDEPENDS

In reply to Khem Raj

From: Khem Raj <[email protected]>

Needed by the ptest suite.

---
 .../python/python3-google-auth-oauthlib_1.4.0.bb                 | 1 +
 1 file changed, 1 insertion(+)
meta-python/recipes-devtools/python/python3-google-auth-oauthlib_1.4.0.bb +1 -0
index 3f56b5b45d..a6c16c4800 100644
@@ -16,6 +16,7 @@ SRC_URI += " \
 
 RDEPENDS:${PN}-ptest += " \
         python3-click \
+        python3-cryptography \
         python3-mock \
         python3-pytest \
         python3-unittest-automake-output \
author
#6 lore raw

PATCH 7/12 python3-rich-toolkit: add python3-pydantic to ptest RDEPENDS

In reply to Khem Raj

From: Khem Raj <[email protected]>

Needed by the ptest suite.

---
 .../recipes-devtools/python/python3-rich-toolkit_0.20.3.bb    | 4 ++++
 1 file changed, 4 insertions(+)
meta-python/recipes-devtools/python/python3-rich-toolkit_0.20.3.bb +4 -0
index 3f54f47790..a0b1eed56e 100644
@@ -15,3 +15,7 @@ RDEPENDS:${PN} = "\
     python3-typing-extensions \
     python3-inline-snapshot \
 "
+
+RDEPENDS:${PN}-ptest += "\
+    python3-pydantic \
+"
author
#7 lore raw

PATCH 8/12 python3-portion: add misc/statistics RDEPENDS for pytest-benchmark

In reply to Khem Raj

From: Khem Raj <[email protected]>

python3-misc for timeit, python3-statistics for statistics, both used by pytest-benchmark's storage/stats machinery.

---
 meta-python/recipes-devtools/python/python3-portion_2.6.2.bb | 4 ++++
 1 file changed, 4 insertions(+)
meta-python/recipes-devtools/python/python3-portion_2.6.2.bb +4 -0
index f72784e23b..ecd524ed33 100644
@@ -13,8 +13,12 @@ RDEPENDS:${PN} += "\
 	python3-sortedcontainers \
 "
 
+# python3-misc for timeit, python3-statistics for statistics (both used by
+# pytest-benchmark's storage/stats machinery)
 RDEPENDS:${PN}-ptest += "\
+	python3-misc \
 	python3-pytest-benchmark \
+	python3-statistics \
 "
 
 do_install_ptest:append () {
author
#8 lore raw

PATCH 9/12 python3-pytest-env: add python3-python-dotenv to ptest RDEPENDS

In reply to Khem Raj

From: Khem Raj <[email protected]>

Needed by the ptest suite.

---
 meta-python/recipes-devtools/python/python3-pytest-env_1.7.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta-python/recipes-devtools/python/python3-pytest-env_1.7.0.bb +1 -0
index 0930573448..3ffe73b864 100644
@@ -18,4 +18,5 @@ RDEPENDS:${PN}-ptest += " \
     python3-covdefaults \
     python3-coverage \
     python3-pytest-mock \
+    python3-python-dotenv \
 "
author
#9 lore raw

PATCH 10/12 python3-gunicorn: add python3-multiprocessing to ptest RDEPENDS

In reply to Khem Raj

From: Khem Raj <[email protected]>

gevent.monkey.patch_all() internally does "import multiprocessing" during _gevent_did_monkey_patch (gevent/subprocess.py); without python3-multiprocessing installed this raises ModuleNotFoundError, crashing any gunicorn gevent-worker boot. Explains both the direct import-order test failures and the ConnectionResetError seen in the control-socket integration tests, since the worker process crashes mid-boot in both cases.

---
 .../python/python3-gunicorn_26.0.0.bb                | 12 ++++++++++++
 1 file changed, 12 insertions(+)
meta-python/recipes-devtools/python/python3-gunicorn_26.0.0.bb +12 -0
index 449c9685ca..575e8a66e1 100644
@@ -19,13 +19,25 @@ RDEPENDS:${PN}-ptest += " \
     python3-eventlet \
     python3-gevent \
     python3-misc \
+    python3-multiprocessing \
     python3-pytest \
+    python3-pytest-asyncio \
     python3-unittest-automake-output \
 "
 
 do_install_ptest() {
 	install -d ${D}${PTEST_PATH}/tests
 	cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+	# tests/docker/* are docker-compose/Dockerfile-driven integration tests
+	# requiring a Docker daemon, which the ptest QEMU environment doesn't have
+	rm -rf ${D}${PTEST_PATH}/tests/docker
+	# upstream's pyproject.toml sets asyncio_mode=auto for the async tests
+	# under tests/dirty and tests/ctl; provide just that bit without pulling
+	# in the rest of upstream's addopts (e.g. --cov=gunicorn)
+	cat > ${D}${PTEST_PATH}/pytest.ini <<EOF
+[pytest]
+asyncio_mode = auto
+EOF
 }
 
 RDEPENDS:${PN} += "python3-setuptools python3-fcntl"
author
#10 lore raw

PATCH 11/12 python3-msgpack: add python3-misc for tracemalloc used by test_except.py

In reply to Khem Raj

From: Khem Raj <[email protected]>

---
 meta-python/recipes-devtools/python/python3-msgpack_1.2.1.bb | 5 +++++
 1 file changed, 5 insertions(+)
meta-python/recipes-devtools/python/python3-msgpack_1.2.1.bb +5 -0
index 283068a71a..f8154598ac 100644
@@ -12,4 +12,9 @@ RDEPENDS:${PN}:append:class-target = " \
     python3-io \
 "
 
+# python3-misc for tracemalloc (used by test/test_except.py)
+RDEPENDS:${PN}-ptest += " \
+    python3-misc \
+"
+
 BBCLASSEXTEND = "native nativesdk"
author
#11 lore raw

PATCH 12/12 python3-wsproto: drop stale PTEST_PYTEST_DIR override

In reply to Khem Raj

From: Khem Raj <[email protected]>

Upstream ships its test suite under tests/ (plural), but the recipe overrode PTEST_PYTEST_DIR to "test" (singular), which doesn't exist in the source tree. ptest-python-pytest.bbclass's default is already "tests"; drop the override so the real directory gets installed and run instead of nothing.

---
 meta-python/recipes-devtools/python/python3-wsproto_1.3.2.bb | 2 --
 1 file changed, 2 deletions(-)
meta-python/recipes-devtools/python/python3-wsproto_1.3.2.bb +0 -2
index 3a9b18b7af..8ab84d7a09 100644
@@ -5,8 +5,6 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=69fabf732409f4ac61875827b258caaf"
 
 inherit pypi python_setuptools_build_meta ptest-python-pytest
 
-PTEST_PYTEST_DIR = "test"
-
 SRC_URI[sha256sum] = "b86885dcf294e15204919950f666e06ffc6c7c114ca900b060d6e16293528294"
 
 RDEPENDS:${PN} += " \