Explorar o código

package/apscheduler: new runtime test

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
Signed-off-by: Julien Olivain <ju.o@free.fr>
Marcus Hoffmann hai 2 meses
pai
achega
6bcc6aba29

+ 2 - 0
DEVELOPERS

@@ -2302,6 +2302,7 @@ F:	package/python-typing-inspection/
 F:	package/python-tzlocal/
 F:	package/python-sdbus-modemmanager/
 F:	package/python-waitress/
+F:	support/testing/tests/package/test_python_apscheduler.py
 F:	support/testing/tests/package/test_python_crc.py
 F:	support/testing/tests/package/test_python_django.py
 F:	support/testing/tests/package/test_python_fastapi.py
@@ -2311,6 +2312,7 @@ F:	support/testing/tests/package/test_python_ruamel_yaml.py
 F:	support/testing/tests/package/test_python_sdbus_modemmanager.py
 F:	support/testing/tests/package/test_python_tzlocal.py
 F:	support/testing/tests/package/test_python_waitress.py
+F:	support/testing/tests/package/sample_python_apscheduler.py
 F:	support/testing/tests/package/sample_python_crc.py
 F:	support/testing/tests/package/sample_python_django.py
 F:	support/testing/tests/package/sample_python_fastapi.py

+ 15 - 0
support/testing/tests/package/sample_python_apscheduler.py

@@ -0,0 +1,15 @@
+from queue import Queue
+from apscheduler.schedulers.background import BackgroundScheduler
+
+queue = Queue()
+
+
+def work():
+    queue.put("Ping!")
+
+
+scheduler = BackgroundScheduler()
+scheduler.add_job(work, "interval", seconds=1)
+scheduler.start()
+result = queue.get(timeout=3)
+assert result == "Ping!"

+ 12 - 0
support/testing/tests/package/test_python_apscheduler.py

@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Apscheduler(TestPythonPackageBase):
+    __test__ = True
+    config = TestPythonPackageBase.config + \
+        """
+        BR2_PACKAGE_PYTHON3=y
+        BR2_PACKAGE_PYTHON_APSCHEDULER=y
+        """
+    sample_scripts = ["tests/package/sample_python_apscheduler.py"]
+    timeout = 15