diff --git a/meta/conf/distro/include/ptest-packagelists.inc b/meta/conf/distro/include/ptest-packagelists.inc
index 50b971bace..7ec75757bc 100644
--- a/meta/conf/distro/include/ptest-packagelists.inc
+++ b/meta/conf/distro/include/ptest-packagelists.inc
@@ -155,6 +155,7 @@ PTESTS_SLOW = "\
     python3-cryptography \
     python3-numpy \
     python3-uvloop \
+    python3-websockets \
     python3-xmltodict \
     strace \
     tar \
diff --git a/meta/recipes-devtools/python/python3-websockets/run-ptest b/meta/recipes-devtools/python/python3-websockets/run-ptest
new file mode 100755
index 0000000000..a71ba0b951
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-websockets/run-ptest
@@ -0,0 +1,3 @@
+#!/bin/sh
+# tests/trio requires python3-trio, which is not in oe-core
+pytest --automake --ignore=tests/trio
diff --git a/meta/recipes-devtools/python/python3-websockets_17.1.bb b/meta/recipes-devtools/python/python3-websockets_17.1.bb
index b5ee3ec661..d1bec373e0 100644
--- a/meta/recipes-devtools/python/python3-websockets_17.1.bb
+++ b/meta/recipes-devtools/python/python3-websockets_17.1.bb
@@ -4,12 +4,23 @@ HOMEPAGE = "https://github.com/aaugustin/websockets"
 LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=51924a6af4495b8cfaee1b1da869b6f4"
 
-inherit pypi python_setuptools_build_meta
+# The PyPI sdist prunes tests, so fetch from git for ptest
+SRC_URI = "\
+    git://github.com/python-websockets/websockets;branch=main;protocol=https;tag=${PV} \
+    file://run-ptest \
+"
+SRCREV = "e87ea9be0373edd5065b5e94dfa714cfde23023b"
+
+CVE_PRODUCT = "websockets_project:websockets"
 
-SRC_URI[sha256sum] = "acfea4c20bf54384883ea33b1240fc1db4f52e190823a4e2b334bc3e8bfca96a"
+inherit python_setuptools_build_meta ptest-python-pytest
 
 BBCLASSEXTEND = "native nativesdk"
 
 RDEPENDS:${PN} = " \
     python3-asyncio \
 "
+
+RDEPENDS:${PN}-ptest += "\
+    python3-misc \
+"
