support/testing: python-requests: new runtime test

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
[Peter: Fix flake8 warning, use http.server instead of relying on
        connectivity]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
(cherry picked from commit 425abcd025)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
This commit is contained in:
Marcus Hoffmann
2026-02-02 16:01:41 +01:00
committed by Thomas Perale
parent b5095f2be6
commit c4f6278bb8
3 changed files with 27 additions and 0 deletions
+2
View File
@@ -2229,12 +2229,14 @@ F: support/testing/tests/package/test_python_django.py
F: support/testing/tests/package/test_python_fastapi.py
F: support/testing/tests/package/test_python_pydantic.py
F: support/testing/tests/package/test_python_pydantic_settings.py
F: support/testing/tests/package/test_python_requests.py
F: support/testing/tests/package/test_python_ruamel_yaml.py
F: support/testing/tests/package/test_python_waitress.py
F: support/testing/tests/package/sample_python_django.py
F: support/testing/tests/package/sample_python_fastapi.py
F: support/testing/tests/package/sample_python_pydantic.py
F: support/testing/tests/package/sample_python_pydantic_settings.py
F: support/testing/tests/package/sample_python_requests.py
F: support/testing/tests/package/sample_python_ruamel_yaml.py
N: Marek Belisko <marek.belisko@open-nandra.com>
@@ -0,0 +1,4 @@
import requests
r = requests.get("http://localhost")
assert r.status_code == 200
@@ -0,0 +1,21 @@
import os
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy3Requests(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_REQUESTS=y
"""
sample_scripts = ["tests/package/sample_python_requests.py"]
timeout = 15
def login(self):
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
self.emulator.boot(arch="armv7",
kernel="builtin",
options=["-initrd", cpio_file])
self.emulator.login()
self.assertRunOk("python3 -m http.server 80 &")