diff mbox series

python3-websockets: enable ptest

Message ID 20260718192949.1269959-1-tim.orling@konsulko.com
State New
Headers show
Series python3-websockets: enable ptest | expand

Commit Message

Tim Orling July 18, 2026, 7:29 p.m. UTC
From: Tim Orling <tim.orling@konsulko.com>

* Add a subset of tests provided in the sdist instead of the full
  suite provided in the git checkout.
* Skip 2 test cases that fail in test_imports.py::test_get_alias,
  test_get_deprecated_alias due to an inherent test-order/caching
  issue in that test module.
* Do not add python3-werkzeug (from meta-python) as a dependency
  so we can limit to oe-core only.
* 301 test cases pass with no failures.

Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 meta/conf/distro/include/ptest-packagelists.inc  |  1 +
 .../python/python3-websockets/run-ptest          |  7 +++++++
 .../python/python3-websockets_16.1.1.bb          | 16 +++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-devtools/python/python3-websockets/run-ptest
diff mbox series

Patch

diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 2badb56c48..abe777e178 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -93,6 +93,7 @@  PTESTS_FAST = "\
     python3-uritools \
     python3-wcwidth \
     python3-webcolors \
+    python3-websockets \
     python3-wheel \
     qemu \
     quilt \
diff --git a/meta/recipes-devtools/python/python3-websockets/run-ptest b/meta/recipes-devtools/python/python3-websockets/run-ptest
new file mode 100644
index 0000000000..5fe2bdf545
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-websockets/run-ptest
@@ -0,0 +1,7 @@ 
+#!/bin/sh
+
+# Skip these 2 test cases with fail due to an inherent test-order/caching
+# issue in that test module
+pytest --automake \
+    --deselect=tests/test_imports.py::ImportsTests::test_get_alias \
+    --deselect=tests/test_imports.py::ImportsTests::test_get_deprecated_alias
diff --git a/meta/recipes-devtools/python/python3-websockets_16.1.1.bb b/meta/recipes-devtools/python/python3-websockets_16.1.1.bb
index 2e2eb0c3ed..6baa744fac 100644
--- a/meta/recipes-devtools/python/python3-websockets_16.1.1.bb
+++ b/meta/recipes-devtools/python/python3-websockets_16.1.1.bb
@@ -4,7 +4,9 @@  HOMEPAGE = "https://github.com/aaugustin/websockets"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=51924a6af4495b8cfaee1b1da869b6f4"
 
-inherit pypi python_setuptools_build_meta
+inherit pypi python_setuptools_build_meta ptest-python-pytest
+
+SRC_URI += "file://run-ptest"
 
 SRC_URI[sha256sum] = "db234eda965dcce15df96bb9709f587cd87d4d52aaf0e80e2f34ec04c7670c57"
 
@@ -13,3 +15,15 @@  BBCLASSEXTEND = "native nativesdk"
 RDEPENDS:${PN} = " \
     python3-asyncio \
 "
+
+do_install_ptest:append() {
+    # These modules import test helpers from tests/asyncio, tests/sync or
+    # tests/extensions, which exist in the git checkout but are not part
+    # of the sdist, so they fail to collect. Drop them and keep only the
+    # self-contained sdist tests.
+    for f in test_auth.py test_cli.py test_client.py test_connection.py \
+             test_exceptions.py test_frames.py test_http.py test_http11.py \
+             test_protocol.py test_server.py test_streams.py; do
+        rm -f ${D}${PTEST_PATH}/tests/$f
+    done
+}