From ca2ff29ba6db647941d90ed7c65721ede1231dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20M=C3=A9lotte?= Date: Mon, 14 Apr 2025 19:14:30 +0200 Subject: [PATCH] support/testing: add new test for python-urllib3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Importing urllib3 already allows us to check that for example zlib can be loaded at runtime. For good measure, also create the PoolManager object mentioned in the user guide ([1]), and check that we can normalize a URL like it is done in urllib3's 'test/test_util.py'. [1]: https://urllib3.readthedocs.io/en/stable/user-guide.html Signed-off-by: Raphaël Mélotte Signed-off-by: Julien Olivain (cherry picked from commit 3e931caf8431bd558a4fc71570d19a000c698d66) Signed-off-by: Thomas Perale --- DEVELOPERS | 2 ++ .../testing/tests/package/sample_python_urllib3.py | 9 +++++++++ support/testing/tests/package/test_python_urllib3.py | 12 ++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 support/testing/tests/package/sample_python_urllib3.py create mode 100644 support/testing/tests/package/test_python_urllib3.py diff --git a/DEVELOPERS b/DEVELOPERS index 8b78eecac8..fce7e968bf 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -2805,12 +2805,14 @@ F: support/testing/tests/package/sample_python_rsa.py F: support/testing/tests/package/sample_python_s3transfer.py F: support/testing/tests/package/sample_python_sdbus.py F: support/testing/tests/package/sample_python_sdbus_networkmanager.py +F: support/testing/tests/package/sample_python_urllib3.py F: support/testing/tests/package/test_python_jmespath.py F: support/testing/tests/package/test_python_pymupdf.py F: support/testing/tests/package/test_python_rsa.py F: support/testing/tests/package/test_python_s3transfer.py F: support/testing/tests/package/test_python_sdbus.py F: support/testing/tests/package/test_python_sdbus_networkmanager.py +F: support/testing/tests/package/test_python_urllib3.py N: Raphael Pavlidis F: package/nvidia-persistenced/ diff --git a/support/testing/tests/package/sample_python_urllib3.py b/support/testing/tests/package/sample_python_urllib3.py new file mode 100644 index 0000000000..9e0cf8c17a --- /dev/null +++ b/support/testing/tests/package/sample_python_urllib3.py @@ -0,0 +1,9 @@ +# Check that we can import urllib3 even if we don't use all of it: +import urllib3 + +# Just check that we can create a PoolManager: +http = urllib3.PoolManager() + +# Check if we can normalize URLs: +assert urllib3.util.url.parse_url("HTTPS://Example.Com/?Key=Value").url \ + == "https://example.com/?Key=Value" diff --git a/support/testing/tests/package/test_python_urllib3.py b/support/testing/tests/package/test_python_urllib3.py new file mode 100644 index 0000000000..54a94d5e65 --- /dev/null +++ b/support/testing/tests/package/test_python_urllib3.py @@ -0,0 +1,12 @@ +from tests.package.test_python import TestPythonPackageBase + + +class TestPythonPy3Urllib3(TestPythonPackageBase): + __test__ = True + config = TestPythonPackageBase.config + \ + """ + BR2_PACKAGE_PYTHON3=y + BR2_PACKAGE_PYTHON_URLLIB3=y + """ + sample_scripts = ["tests/package/sample_python_urllib3.py"] + timeout = 20