From 23b09174022b2fdf990b00a6f9556d63a0325f90 Mon Sep 17 00:00:00 2001 From: ruaridhg <32329546+ruaridhg@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:18:43 +0000 Subject: [PATCH] Moved tests folder out of src (#261) * Moved tests folder out of src * run-tests points at correct folder --------- Co-authored-by: ruaridhg --- pixl_dcmd/bin/run-tests.sh | 2 +- pixl_dcmd/{src/pixl_dcmd => }/tests/__init__.py | 0 pixl_dcmd/{src/pixl_dcmd => }/tests/conftest.py | 0 pixl_dcmd/{src/pixl_dcmd => }/tests/test_datetime.py | 0 pixl_dcmd/{src/pixl_dcmd => }/tests/test_deid_helpers.py | 0 pixl_dcmd/{src/pixl_dcmd => }/tests/test_main.py | 6 +++--- 6 files changed, 4 insertions(+), 4 deletions(-) rename pixl_dcmd/{src/pixl_dcmd => }/tests/__init__.py (100%) rename pixl_dcmd/{src/pixl_dcmd => }/tests/conftest.py (100%) rename pixl_dcmd/{src/pixl_dcmd => }/tests/test_datetime.py (100%) rename pixl_dcmd/{src/pixl_dcmd => }/tests/test_deid_helpers.py (100%) rename pixl_dcmd/{src/pixl_dcmd => }/tests/test_main.py (94%) diff --git a/pixl_dcmd/bin/run-tests.sh b/pixl_dcmd/bin/run-tests.sh index 024afc408..770867555 100755 --- a/pixl_dcmd/bin/run-tests.sh +++ b/pixl_dcmd/bin/run-tests.sh @@ -18,4 +18,4 @@ BIN_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) PACKAGE_DIR="${BIN_DIR%/*}" cd "$PACKAGE_DIR" -pytest src/pixl_dcmd/tests +pytest tests diff --git a/pixl_dcmd/src/pixl_dcmd/tests/__init__.py b/pixl_dcmd/tests/__init__.py similarity index 100% rename from pixl_dcmd/src/pixl_dcmd/tests/__init__.py rename to pixl_dcmd/tests/__init__.py diff --git a/pixl_dcmd/src/pixl_dcmd/tests/conftest.py b/pixl_dcmd/tests/conftest.py similarity index 100% rename from pixl_dcmd/src/pixl_dcmd/tests/conftest.py rename to pixl_dcmd/tests/conftest.py diff --git a/pixl_dcmd/src/pixl_dcmd/tests/test_datetime.py b/pixl_dcmd/tests/test_datetime.py similarity index 100% rename from pixl_dcmd/src/pixl_dcmd/tests/test_datetime.py rename to pixl_dcmd/tests/test_datetime.py diff --git a/pixl_dcmd/src/pixl_dcmd/tests/test_deid_helpers.py b/pixl_dcmd/tests/test_deid_helpers.py similarity index 100% rename from pixl_dcmd/src/pixl_dcmd/tests/test_deid_helpers.py rename to pixl_dcmd/tests/test_deid_helpers.py diff --git a/pixl_dcmd/src/pixl_dcmd/tests/test_main.py b/pixl_dcmd/tests/test_main.py similarity index 94% rename from pixl_dcmd/src/pixl_dcmd/tests/test_main.py rename to pixl_dcmd/tests/test_main.py index 89228539d..3168cfa2a 100644 --- a/pixl_dcmd/src/pixl_dcmd/tests/test_main.py +++ b/pixl_dcmd/tests/test_main.py @@ -32,7 +32,7 @@ def tag_scheme() -> dict: """Read the tag scheme from orthanc raw.""" tag_file = ( - pathlib.Path(__file__).parents[4] + pathlib.Path(__file__).parents[2] / "orthanc/orthanc-anon/plugin/tag-operations.yaml" ) return yaml.safe_load(tag_file.read_text()) @@ -57,7 +57,7 @@ def test_image_already_exported_throws(rows_in_session, tag_scheme): WHEN the dicom tag scheme is applied THEN an exception will be thrown as """ - exported_dicom = pathlib.Path(__file__).parents[4] / "test/resources/Dicom1.dcm" + exported_dicom = pathlib.Path(__file__).parents[2] / "test/resources/Dicom1.dcm" input_dataset = pydicom.dcmread(exported_dicom) with pytest.raises(sqlalchemy.exc.NoResultFound): @@ -71,7 +71,7 @@ def test_pseudo_identifier_processing(rows_in_session, tag_scheme): THEN the patient identifier tag should be the mrn and accession hashed and the pipeline db row should now have the fake hash """ - exported_dicom = pathlib.Path(__file__).parents[4] / "test/resources/Dicom2.dcm" + exported_dicom = pathlib.Path(__file__).parents[2] / "test/resources/Dicom2.dcm" input_dataset = pydicom.dcmread(exported_dicom) accession_number = "AA12345605"