python3-django: add ptest support

Execute the standard, non-selenium tests. The execution is
on the slower side: on my idle machine, KVM enabled it takes
a bit more than 2.5 minutes to execute it (executing tests with
4 threads parallel, 1/core, the default configuration). If the machine is
under load, it easily grows to over 10 minutes.

Added two backported patches for Django 5.2 to fix some tests that
would otherwise fail:

0001-Fix-test_strip_tags-test.patch: tag stripping tests failed due to
changed Python behavior

0001-fix-test_msgfmt_error_including_non_ascii-test.patch: tests were
updated to work with msgfmt 0.25

Most of the skipped tests require some specific database backend
(Postgres, MySQL, Oracle...) or are Selenium tests.

The output is very long (the suite contains way over 15k tests),
so I omit the example output here.

The current summary (for v5.2.9):
Ran 18121 tests in 140.891s
OK (skipped=1394, expected failures=5)

Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Gyorgy Sarvari
2026-01-18 17:27:37 +01:00
committed by Khem Raj
parent c6a097b942
commit e1b26f8677
7 changed files with 202 additions and 1 deletions

View File

@@ -6,7 +6,9 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=f09eb47206614a4954c51db8a94840fa"
PYPI_PACKAGE = "django"
UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
inherit pypi
inherit pypi ptest
SRC_URI += "file://run-ptest"
FILES:${PN} += "${datadir}/django"
@@ -31,3 +33,31 @@ RDEPENDS:${PN} += "\
"
CVE_PRODUCT = "django"
do_install_ptest(){
install -d ${D}${PTEST_PATH}//docs/_ext
install -m 0644 ${S}/docs/_ext/github_links.py ${D}${PTEST_PATH}/docs/_ext
cp -r ${S}/tests ${D}${PTEST_PATH}
sed -i 's,/usr/bin/env python,/usr/bin/env python3,' ${D}${PTEST_PATH}/tests/runtests.py
ln -sr ${D}${libdir}/python3.*/site-packages/django ${D}${PTEST_PATH}/django
}
RDEPENDS:${PN}-ptest += " \
gettext \
python3-asgiref \
python3-bcrypt \
python3-compile \
python3-docutils \
python3-fcntl \
python3-jinja2 \
python3-misc \
python3-numpy \
python3-pillow \
python3-pyyaml \
python3-sqlite3 \
python3-statistics \
python3-tblib \
python3-zoneinfo \
tzdata \
"