diff mbox series

[meta-python] python3-freezegun: add recipe and add ptest

Message ID 20240305101229.304761-1-alperyasinak1@gmail.com
State Accepted
Headers show
Series [meta-python] python3-freezegun: add recipe and add ptest | expand

Commit Message

Alper Ak March 5, 2024, 10:12 a.m. UTC
FreezeGun is a library that allows your Python tests to travel through time by mocking the datetime module.

* Tested on qemux86-64 and qemuarm64
* Add ptest into PTESTS_FAST_META_PYTHON

Ptest result:
=============
qemuarm64:

Testsuite summary
TOTAL: 127
PASS: 121
SKIP: 6
XFAIL: 0
FAIL: 0
XPASS: 0
ERROR: 0
DURATION: 20
END: /usr/lib/python3-freezegun/ptest
2024-03-05T06:53
STOP: ptest-runner
TOTAL: 1 FAIL: 0

qemux86-64:

Testsuite summary
TOTAL: 127
PASS: 121
SKIP: 6
XFAIL: 0
FAIL: 0
XPASS: 0
ERROR: 0
DURATION: 21
END: /usr/lib/python3-freezegun/ptest
2024-03-05T06:57
STOP: ptest-runner
TOTAL: 1 FAIL: 0

Signed-off-by: alperak <alperyasinak1@gmail.com>
---
 .../ptest-packagelists-meta-python.inc        |  1 +
 .../python/python3-freezegun/run-ptest        |  3 ++
 .../python/python3-freezegun_1.4.0.bb         | 29 +++++++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-freezegun/run-ptest
 create mode 100644 meta-python/recipes-devtools/python/python3-freezegun_1.4.0.bb
diff mbox series

Patch

diff --git a/meta-python/conf/include/ptest-packagelists-meta-python.inc b/meta-python/conf/include/ptest-packagelists-meta-python.inc
index 3b19152f4..65a45c4b6 100644
--- a/meta-python/conf/include/ptest-packagelists-meta-python.inc
+++ b/meta-python/conf/include/ptest-packagelists-meta-python.inc
@@ -17,6 +17,7 @@  PTESTS_FAST_META_PYTHON = "\
     python3-click \
     python3-dominate \
     python3-execnet \
+    python3-freezegun \
     python3-geojson \
     python3-gpiod \
     python3-gunicorn \
diff --git a/meta-python/recipes-devtools/python/python3-freezegun/run-ptest b/meta-python/recipes-devtools/python/python3-freezegun/run-ptest
new file mode 100644
index 000000000..8d2017d39
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-freezegun/run-ptest
@@ -0,0 +1,3 @@ 
+#!/bin/sh
+
+pytest --automake
diff --git a/meta-python/recipes-devtools/python/python3-freezegun_1.4.0.bb b/meta-python/recipes-devtools/python/python3-freezegun_1.4.0.bb
new file mode 100644
index 000000000..15c0bf06b
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-freezegun_1.4.0.bb
@@ -0,0 +1,29 @@ 
+SUMMARY = "FreezeGun is a library that allows your Python tests to travel through time by mocking the datetime module."
+HOMEPAGE = "https://github.com/spulec/freezegun"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=acf1d209bb6eddae4cbe6ffd6a0144fe"
+
+SRC_URI[sha256sum] = "10939b0ba0ff5adaecf3b06a5c2f73071d9678e507c5eaedb23c761d56ac774b"
+
+inherit pypi python_setuptools_build_meta ptest
+
+SRC_URI += " \
+        file://run-ptest \
+"
+
+RDEPENDS:${PN}-ptest += " \
+        python3-pytest \
+        python3-sqlite3 \
+        python3-unittest-automake-output \
+"
+
+do_install_ptest() {
+        install -d ${D}${PTEST_PATH}/tests
+        cp -rf ${S}/tests/* ${D}${PTEST_PATH}/tests/
+}
+
+RDEPENDS:${PN} = "\
+        python3-asyncio \
+        python3-dateutil \
+        python3-unittest \
+"