From fdc9c0812cb33bce30dbcec2039879cc44bd27b3 Mon Sep 17 00:00:00 2001 From: Stephen Cheng Date: Sun, 28 Apr 2024 02:06:09 +0100 Subject: [PATCH] Merge python3/unittest into python3/tests Signed-off-by: Stephen Cheng --- .codecov.yml | 4 ++-- .github/workflows/main.yml | 2 +- python3/{unittest => tests}/test_hfx_filename.py | 0 python3/{unittest => tests}/test_nbd_client_manager.py | 0 python3/{unittest => tests}/test_perfmon.py | 0 python3/{unittest => tests}/test_usb_scan.py | 4 ++-- 6 files changed, 5 insertions(+), 5 deletions(-) rename python3/{unittest => tests}/test_hfx_filename.py (100%) rename python3/{unittest => tests}/test_nbd_client_manager.py (100%) rename python3/{unittest => tests}/test_perfmon.py (100%) rename python3/{unittest => tests}/test_usb_scan.py (99%) diff --git a/.codecov.yml b/.codecov.yml index 79d69aa0b14..f67f6913dc8 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -214,7 +214,7 @@ coverage: tests: # Ensure that all tests are executed (tests themselves must be 100% covered) target: 98% - paths: ["python3/unittest/test_*.py"] + paths: ["python3/tests/test_*.py"] # @@ -266,5 +266,5 @@ component_management: - component_id: test_cases name: test_cases - paths: ["python3/unittest/test_*.py"] + paths: ["python3/tests/test_*.py"] diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9d55ec60312..da0e2bd35a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,7 +73,7 @@ jobs: run: > pytest --cov=python3/ - python3/unittest python3/tests -vv -rA + python3/tests -vv -rA --junitxml=.git/pytest${{matrix.python-version}}.xml --cov-report term-missing --cov-report xml:.git/coverage${{matrix.python-version}}.xml diff --git a/python3/unittest/test_hfx_filename.py b/python3/tests/test_hfx_filename.py similarity index 100% rename from python3/unittest/test_hfx_filename.py rename to python3/tests/test_hfx_filename.py diff --git a/python3/unittest/test_nbd_client_manager.py b/python3/tests/test_nbd_client_manager.py similarity index 100% rename from python3/unittest/test_nbd_client_manager.py rename to python3/tests/test_nbd_client_manager.py diff --git a/python3/unittest/test_perfmon.py b/python3/tests/test_perfmon.py similarity index 100% rename from python3/unittest/test_perfmon.py rename to python3/tests/test_perfmon.py diff --git a/python3/unittest/test_usb_scan.py b/python3/tests/test_usb_scan.py similarity index 99% rename from python3/unittest/test_usb_scan.py rename to python3/tests/test_usb_scan.py index e5ee00a253a..f63e4bb8f10 100644 --- a/python3/unittest/test_usb_scan.py +++ b/python3/tests/test_usb_scan.py @@ -13,10 +13,11 @@ import mock from python3.tests.import_helper import import_file_as_module - +# mock modules to avoid dependencies sys.modules["xcp"] = mock.Mock() sys.modules["xcp.logger"] = mock.Mock() sys.modules["pyudev"] = mock.Mock() +usb_scan = import_file_as_module("python3/libexec/usb_scan.py") class MocDeviceAttrs(Mapping): @@ -112,7 +113,6 @@ def verify_usb_common( # Use relative path to allow tests to be started in subdirectories path = os.path.dirname(__file__) + "/../../scripts/usb-policy.conf" ): - usb_scan = import_file_as_module("python3/libexec/usb_scan.py") mock_setup(usb_scan, moc_devices, moc_interfaces, path)