From 129a1fb4dbc375be0fa926964aa1be46a0cdbbef Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:54:34 +0200 Subject: Adding upstream version 0.1.21. Signed-off-by: Daniel Baumann --- tests/plugin_tests/numpy3_test.py | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/plugin_tests/numpy3_test.py (limited to 'tests/plugin_tests/numpy3_test.py') diff --git a/tests/plugin_tests/numpy3_test.py b/tests/plugin_tests/numpy3_test.py new file mode 100644 index 0000000..9b252fb --- /dev/null +++ b/tests/plugin_tests/numpy3_test.py @@ -0,0 +1,38 @@ +import os + +import pytest + +from debputy.plugin.api.test_api import ( + initialize_plugin_under_test, + build_virtual_file_system, + package_metadata_context, +) + +DATA_FILE = os.path.join(os.path.dirname(__file__), "numpy3_test.data") + + +@pytest.fixture(scope="session") +def numpy3_stub_data_file() -> None: + os.environ["_NUMPY_TEST_PATH"] = DATA_FILE + yield + try: + del os.environ["_NUMPY_TEST_PATH"] + except KeyError: + pass + + +def test_numpy3_plugin_arch_all(numpy3_stub_data_file) -> None: + plugin = initialize_plugin_under_test() + fs = build_virtual_file_system([]) + context = package_metadata_context(package_fields={"Architecture": "all"}) + metadata = plugin.run_metadata_detector("numpy-depends", fs, context) + assert metadata.substvars["python3:Depends"] == "python3-numpy" + + +def test_numpy3_plugin_arch_any(numpy3_stub_data_file) -> None: + plugin = initialize_plugin_under_test() + fs = build_virtual_file_system([]) + context = package_metadata_context(package_fields={"Architecture": "any"}) + metadata = plugin.run_metadata_detector("numpy-depends", fs, context) + expected = "python3-numpy (>= 1:1.22.0), python3-numpy-abi9" + assert metadata.substvars["python3:Depends"] == expected -- cgit v1.2.3