From 16799a96057ded295afba47bd2326b5f152ea447 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Sun, 16 Oct 2022 19:55:45 +0100 Subject: [PATCH 1/4] rename auto3dseg_autorunner to integration_autorunner test Signed-off-by: Wenqi Li --- tests/min_tests.py | 2 +- ...t_auto3dseg_autorunner.py => test_integration_autorunner.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/{test_auto3dseg_autorunner.py => test_integration_autorunner.py} (100%) diff --git a/tests/min_tests.py b/tests/min_tests.py index 026514e29e..439d95db5f 100644 --- a/tests/min_tests.py +++ b/tests/min_tests.py @@ -29,7 +29,6 @@ def run_testsuit(): exclude_cases = [ # these cases use external dependencies "test_ahnet", "test_arraydataset", - "test_auto3dseg_autorunner", "test_auto3dseg_ensemble", "test_auto3dseg_hpo", "test_auto3dseg", @@ -107,6 +106,7 @@ def run_testsuit(): "test_integration_workflows", "test_integration_workflows_gan", "test_integration_bundle_run", + "test_integration_autorunner", "test_invert", "test_invertd", "test_iterable_dataset", diff --git a/tests/test_auto3dseg_autorunner.py b/tests/test_integration_autorunner.py similarity index 100% rename from tests/test_auto3dseg_autorunner.py rename to tests/test_integration_autorunner.py From dd06ba352443025b2beea28088db90ff0125c3de Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 17 Oct 2022 08:13:05 +0100 Subject: [PATCH 2/4] update ignite conda Signed-off-by: Wenqi Li --- environment-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/environment-dev.yml b/environment-dev.yml index 1f1d9c773f..1b91cb38fc 100644 --- a/environment-dev.yml +++ b/environment-dev.yml @@ -9,7 +9,7 @@ dependencies: - coverage>=5.5 - parameterized - setuptools>=50.3.0,!=60.0.0 - - ignite==0.4.8 + - ignite==0.4.10 - gdown>=4.4.0 - scipy - nibabel From c049954390f7139e0203f9660f5fe62f35029485 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 17 Oct 2022 09:36:24 +0100 Subject: [PATCH 3/4] less memory test mask Signed-off-by: Wenqi Li --- tests/test_masked_inference_wsi_dataset.py | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/test_masked_inference_wsi_dataset.py b/tests/test_masked_inference_wsi_dataset.py index 661f728e47..8d471ae478 100644 --- a/tests/test_masked_inference_wsi_dataset.py +++ b/tests/test_masked_inference_wsi_dataset.py @@ -10,6 +10,7 @@ # limitations under the License. import os +import tempfile import unittest from unittest import skipUnless @@ -30,23 +31,21 @@ FILE_NAME = f"temp_{base_name}" FILE_PATH = os.path.join(os.path.dirname(__file__), "testing_data", FILE_NAME + extension) -MASK1 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask1.npy") -MASK2 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask2.npy") -MASK4 = os.path.join(os.path.dirname(__file__), "testing_data", "temp_tissue_mask4.npy") +MASK1, MASK2, MASK4 = "mask1.npy", "mask2.npy", "mask4.npy" HEIGHT = 32914 WIDTH = 46000 -def prepare_data(): +def prepare_data(*masks): mask = np.zeros((HEIGHT // 2, WIDTH // 2)) mask[100, 100] = 1 - np.save(MASK1, mask) + np.save(masks[0], mask) mask[100, 101] = 1 - np.save(MASK2, mask) + np.save(masks[1], mask) mask[100:102, 100:102] = 1 - np.save(MASK4, mask) + np.save(masks[2], mask) TEST_CASE_0 = [ @@ -158,15 +157,21 @@ def prepare_data(): class TestMaskedInferenceWSIDataset(unittest.TestCase): def setUp(self): - prepare_data() + self.base_dir = tempfile.TemporaryDirectory() + prepare_data(*[os.path.join(self.base_dir.name, m) for m in [MASK1, MASK2, MASK4]]) hash_type = testing_data_config("images", FILE_KEY, "hash_type") hash_val = testing_data_config("images", FILE_KEY, "hash_val") download_url_or_skip_test(FILE_URL, FILE_PATH, hash_type=hash_type, hash_val=hash_val) + def tearDown(self): + self.base_dir.cleanup() + @parameterized.expand([TEST_CASE_0, TEST_CASE_1, TEST_CASE_2, TEST_CASE_3, TEST_CASE_4]) @skipUnless(has_cim, "Requires CuCIM") @skip_if_quick def test_read_patches_cucim(self, input_parameters, expected): + for m in input_parameters["data"]: + m["mask"] = os.path.join(self.base_dir.name, m["mask"]) dataset = MaskedInferenceWSIDataset(**input_parameters) self.compare_samples_expected(dataset, expected) @@ -174,6 +179,8 @@ def test_read_patches_cucim(self, input_parameters, expected): @skipUnless(has_osl, "Requires OpenSlide") @skip_if_quick def test_read_patches_openslide(self, input_parameters, expected): + for m in input_parameters["data"]: + m["mask"] = os.path.join(self.base_dir.name, m["mask"]) dataset = MaskedInferenceWSIDataset(**input_parameters) self.compare_samples_expected(dataset, expected) From 4d1355291f444c901ce8b3c210a4b1b591fc3cc7 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 17 Oct 2022 09:43:05 +0100 Subject: [PATCH 4/4] integration tests Signed-off-by: Wenqi Li --- .github/workflows/setupapp.yml | 2 +- tests/test_masked_inference_wsi_dataset.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/setupapp.yml b/.github/workflows/setupapp.yml index 71c59457fb..db8f43dad7 100644 --- a/.github/workflows/setupapp.yml +++ b/.github/workflows/setupapp.yml @@ -23,7 +23,7 @@ jobs: container: image: nvcr.io/nvidia/pytorch:21.06-py3 # CUDA 11.3 options: --gpus all - runs-on: [self-hosted, linux, x64, common] + runs-on: [self-hosted, linux, x64, integration] steps: - uses: actions/checkout@v3 - name: cache weekly timestamp diff --git a/tests/test_masked_inference_wsi_dataset.py b/tests/test_masked_inference_wsi_dataset.py index 8d471ae478..c424edd897 100644 --- a/tests/test_masked_inference_wsi_dataset.py +++ b/tests/test_masked_inference_wsi_dataset.py @@ -155,6 +155,7 @@ def prepare_data(*masks): ] +@skip_if_quick class TestMaskedInferenceWSIDataset(unittest.TestCase): def setUp(self): self.base_dir = tempfile.TemporaryDirectory()