diff --git a/monai/data/test_time_augmentation.py b/monai/data/test_time_augmentation.py index 23572dcef4..bcd5ea91a9 100644 --- a/monai/data/test_time_augmentation.py +++ b/monai/data/test_time_augmentation.py @@ -106,6 +106,8 @@ class TestTimeAugmentation: mode, mean, std, vvc = tt_aug(test_data) """ + __test__ = False # indicate to pytest that this class is not intended for collection + def __init__( self, transform: InvertibleTransform, diff --git a/tests/test_arraydataset.py b/tests/test_arraydataset.py index b61b3c139c..03239a9764 100644 --- a/tests/test_arraydataset.py +++ b/tests/test_arraydataset.py @@ -40,6 +40,7 @@ class TestCompose(Compose): + __test__ = False # indicate to pytest that this class is not intended for collection def __call__(self, input_, lazy=False): img = self.transforms[0](input_) diff --git a/tests/test_auto3dseg.py b/tests/test_auto3dseg.py index 6be33bf6ca..5273f0663a 100644 --- a/tests/test_auto3dseg.py +++ b/tests/test_auto3dseg.py @@ -123,6 +123,8 @@ class TestOperations(Operations): Test example for user operation """ + __test__ = False # indicate to pytest that this class is not intended for collection + def __init__(self) -> None: self.data = {"max": np.max, "mean": np.mean, "min": np.min} @@ -132,6 +134,8 @@ class TestAnalyzer(Analyzer): Test example for a simple Analyzer """ + __test__ = False # indicate to pytest that this class is not intended for collection + def __init__(self, key, report_format, stats_name="test"): self.key = key super().__init__(stats_name, report_format) @@ -149,6 +153,8 @@ class TestImageAnalyzer(Analyzer): Test example for a simple Analyzer """ + __test__ = False # indicate to pytest that this class is not intended for collection + def __init__(self, image_key="image", stats_name="test_image"): self.image_key = image_key report_format = {"test_stats": None} diff --git a/tests/test_convert_data_type.py b/tests/test_convert_data_type.py index b95539f4b7..a27a05cf28 100644 --- a/tests/test_convert_data_type.py +++ b/tests/test_convert_data_type.py @@ -73,6 +73,7 @@ class TestTensor(torch.Tensor): + __test__ = False # indicate to pytest that this class is not intended for collection pass diff --git a/tests/test_handler_prob_map_producer.py b/tests/test_handler_prob_map_producer.py index 347f8cb92c..406fe77c8f 100644 --- a/tests/test_handler_prob_map_producer.py +++ b/tests/test_handler_prob_map_producer.py @@ -30,6 +30,7 @@ class TestDataset(Dataset): + __test__ = False # indicate to pytest that this class is not intended for collection def __init__(self, name, size): super().__init__( @@ -64,6 +65,7 @@ def __getitem__(self, index): class TestEvaluator(Evaluator): + __test__ = False # indicate to pytest that this class is not intended for collection def _iteration(self, engine, batchdata): return batchdata diff --git a/tests/test_handler_validation.py b/tests/test_handler_validation.py index 752b1d3df7..92f8578f11 100644 --- a/tests/test_handler_validation.py +++ b/tests/test_handler_validation.py @@ -22,6 +22,7 @@ class TestEvaluator(Evaluator): + __test__ = False # indicate to pytest that this class is not intended for collection def _iteration(self, engine, batchdata): engine.state.output = "called" diff --git a/tests/test_image_filter.py b/tests/test_image_filter.py index adc9dade9c..76e38d94f4 100644 --- a/tests/test_image_filter.py +++ b/tests/test_image_filter.py @@ -38,6 +38,7 @@ class TestModule(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def __init__(self): super().__init__() diff --git a/tests/test_prepare_batch_default.py b/tests/test_prepare_batch_default.py index 9aa498866f..093468ce27 100644 --- a/tests/test_prepare_batch_default.py +++ b/tests/test_prepare_batch_default.py @@ -21,6 +21,7 @@ class TestNet(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def forward(self, x: torch.Tensor): return x diff --git a/tests/test_prepare_batch_default_dist.py b/tests/test_prepare_batch_default_dist.py index 0c53a74834..53a79575e6 100644 --- a/tests/test_prepare_batch_default_dist.py +++ b/tests/test_prepare_batch_default_dist.py @@ -43,6 +43,7 @@ class TestNet(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def forward(self, x: torch.Tensor): return x diff --git a/tests/test_prepare_batch_extra_input.py b/tests/test_prepare_batch_extra_input.py index f20c6e7352..3c53cc6481 100644 --- a/tests/test_prepare_batch_extra_input.py +++ b/tests/test_prepare_batch_extra_input.py @@ -36,6 +36,7 @@ class TestNet(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def forward(self, x: torch.Tensor, t1=None, t2=None, t3=None): return {"x": x, "t1": t1, "t2": t2, "t3": t3} diff --git a/tests/test_prepare_batch_hovernet.py b/tests/test_prepare_batch_hovernet.py index 773fcb53bf..ae9554a3e8 100644 --- a/tests/test_prepare_batch_hovernet.py +++ b/tests/test_prepare_batch_hovernet.py @@ -28,6 +28,7 @@ class TestNet(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def forward(self, x: torch.Tensor): return {HoVerNetBranch.NP: torch.tensor([1, 2]), HoVerNetBranch.NC: torch.tensor([4, 4]), HoVerNetBranch.HV: 16} diff --git a/tests/test_torchscript_utils.py b/tests/test_torchscript_utils.py index 6f8f231829..5a5fb47864 100644 --- a/tests/test_torchscript_utils.py +++ b/tests/test_torchscript_utils.py @@ -23,6 +23,7 @@ class TestModule(torch.nn.Module): + __test__ = False # indicate to pytest that this class is not intended for collection def forward(self, x): return x + 10