Repository: Project-MONAI/MONAI

Issue:
exclude slow cases for quick tests
**Describe the bug**
some cases are taking significant time (and memory) for quick tests
```
[2023-04-13T20:19:39.751Z] test_consistency_0 (tests.test_dynunet.TestDynUNetWithInstanceNorm3dNVFuser) (10.6s)
[2023-04-13T20:19:39.751Z] test_script_3 (tests.test_senet.TestSENET) (10.6s)
[2023-04-13T20:19:39.751Z] test_cpu_precise_backwards_7_3_dimension_1_channel_high_spatial_sigma_high_color_sigma (tests.test_bilateral_precise.BilateralFilterTestCaseCpuPrecise) (10.7s)
[2023-04-13T20:19:39.751Z] test_onnx_2 (tests.test_retinanet.TestRetinaNet) (11.0s)
[2023-04-13T20:19:39.751Z] test_correct_results_32_value_1 (tests.test_keep_largest_connected_componentd.TestKeepLargestConnectedComponentd) (11.4s)
[2023-04-13T20:19:39.751Z] test_start (tests.test_loader_semaphore.TestImportLock) (11.7s)
[2023-04-13T20:19:39.751Z] test_pdb (tests.test_config_parser.TestConfigParser) (12.1s)
[2023-04-13T20:19:39.751Z] test_script_0 (tests.test_fpn_block.TestFPN) (12.2s)
[2023-04-13T20:19:39.751Z] test_script (tests.test_highresnet.TestHighResNet) (12.8s)
[2023-04-13T20:19:39.751Z] test_shape_24 (tests.test_vitautoenc.TestPatchEmbeddingBlock) (12.9s)
[2023-04-13T20:19:39.751Z] test_dints_inference_3 (tests.test_dints_network.TestDints) (13.8s)
[2023-04-13T20:19:39.751Z] test_dints_inference_2 (tests.test_dints_network.TestDints) (13.9s)
[2023-04-13T20:19:39.751Z] test_onnx_5 (tests.test_retinanet.TestRetinaNet) (13.9s)
[2023-04-13T20:19:39.751Z] test_script (tests.test_hovernet.TestHoverNet) (14.2s)
[2023-04-13T20:19:39.751Z] test_dints_inference_1 (tests.test_dints_network.TestDints) (14.4s)
[2023-04-13T20:19:39.751Z] test_run_algo (tests.test_auto3dseg_hpo.TestHPO) (14.5s)
[2023-04-13T20:19:39.751Z] test_script_0 (tests.test_senet.TestSENET) (15.2s)
[2023-04-13T20:19:39.751Z] test_get_history (tests.test_auto3dseg_hpo.TestHPO) (15.7s)
[2023-04-13T20:19:39.751Z] test_cuda_3_1_batches_3_dimensions_1_channels_2_classes_1_mixtures (tests.test_gmm.GMMTestCase) (16.3s)
[2023-04-13T20:19:39.751Z] test_cuda_1_1_batches_1_dimensions_5_channels_2_classes_1_mixtures (tests.test_gmm.GMMTestCase) (16.4s)
[2023-04-13T20:19:39.751Z] test_load (tests.test_gmm.GMMTestCase) (16.5s)
[2023-04-13T20:19:39.751Z] test_cuda_2_1_batches_2_dimensions_2_channels_4_classes_4_mixtures (tests.test_gmm.GMMTestCase) (16.5s)
[2023-04-13T20:19:39.751Z] test_lr_finder (tests.test_lr_finder.TestLRFinder) (17.8s)
[2023-04-13T20:19:39.751Z] test_cuda_0_2_batches_1_dimensions_1_channels_2_classes_2_mixtures (tests.test_gmm.GMMTestCase) (18.0s)
[2023-04-13T20:19:39.751Z] test_unet_7_cuda (tests.test_convert_to_onnx.TestConvertToOnnx) (19.5s)
[2023-04-13T20:19:39.751Z] test_unet_5_cuda (tests.test_convert_to_onnx.TestConvertToOnnx) (19.5s)
[2023-04-13T20:19:39.751Z] test_unet_3_cpu (tests.test_convert_to_onnx.TestConvertToOnnx) (19.8s)
[2023-04-13T20:19:39.751Z] test_unet_1_cpu (tests.test_convert_to_onnx.TestConvertToOnnx) (19.8s)
[2023-04-13T20:19:39.751Z] test_space_same_shape (tests.test_spacingd.TestSpacingDCase) (24.7s)
[2023-04-13T20:19:39.751Z] test_invert (tests.test_invertd.TestInvertd) (25.2s)
[2023-04-13T20:19:39.751Z] test_run_optuna (tests.test_auto3dseg_hpo.TestHPO) (27.8s)
[2023-04-13T20:19:39.751Z] test_retina_detector_resnet_backbone_shape_0 (tests.test_retinanet_detector.TestRetinaNetDetector) (28.1s)
[2023-04-13T20:19:39.751Z] test_cpu_precise_backwards_5_3_dimensions_1_channel_high_spatial_sigmas_high_color_sigma (tests.test_trainable_bilateral.BilateralFilterTestCaseCpuPrecise) (35.6s)
[2023-04-13T20:19:39.751Z] test_onnx_6 (tests.test_retinanet.TestRetinaNet) (41.7s)
[2023-04-13T20:19:39.751Z] test_cpu_precise_backwards_5_3_dimensions_1_channel_high_spatial_sigmas_high_color_sigma (tests.test_trainable_joint_bilateral.JointBilateralFilterTestCaseCpuPrecise) (49.8s)
```


Discussion:

Resolving patch:
diff --git a/monai/apps/auto3dseg/bundle_gen.py b/monai/apps/auto3dseg/bundle_gen.py
--- a/monai/apps/auto3dseg/bundle_gen.py
+++ b/monai/apps/auto3dseg/bundle_gen.py
@@ -36,7 +36,7 @@
 from monai.utils.enums import AlgoKeys
 
 logger = get_logger(module_name=__name__)
-ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "b37ed82")
+ALGO_HASH = os.environ.get("MONAI_ALGO_HASH", "80c832e")
 
 __all__ = ["BundleAlgo", "BundleGen"]
 


Test patch:
diff --git a/tests/test_bilateral_precise.py b/tests/test_bilateral_precise.py
--- a/tests/test_bilateral_precise.py
+++ b/tests/test_bilateral_precise.py
@@ -19,7 +19,7 @@
 from torch.autograd import gradcheck
 
 from monai.networks.layers.filtering import BilateralFilter
-from tests.utils import skip_if_no_cpp_extension, skip_if_no_cuda
+from tests.utils import skip_if_no_cpp_extension, skip_if_no_cuda, skip_if_quick
 
 TEST_CASES = [
     [
@@ -364,6 +364,7 @@
 
 
 @skip_if_no_cpp_extension
+@skip_if_quick
 class BilateralFilterTestCaseCpuPrecise(unittest.TestCase):
     @parameterized.expand(TEST_CASES)
     def test_cpu_precise(self, test_case_description, sigmas, input, expected):
diff --git a/tests/test_convert_to_onnx.py b/tests/test_convert_to_onnx.py
--- a/tests/test_convert_to_onnx.py
+++ b/tests/test_convert_to_onnx.py
@@ -20,7 +20,7 @@
 from monai.networks import convert_to_onnx
 from monai.networks.nets import SegResNet, UNet
 from monai.utils.module import pytorch_after
-from tests.utils import SkipIfBeforePyTorchVersion, SkipIfNoModule, optional_import
+from tests.utils import SkipIfBeforePyTorchVersion, SkipIfNoModule, optional_import, skip_if_quick
 
 if torch.cuda.is_available():
     TORCH_DEVICE_OPTIONS = ["cpu", "cuda"]
@@ -34,6 +34,7 @@
 
 @SkipIfNoModule("onnx")
 @SkipIfBeforePyTorchVersion((1, 9))
+@skip_if_quick
 class TestConvertToOnnx(unittest.TestCase):
     @parameterized.expand(TESTS)
     def test_unet(self, device, use_trace, use_ort):
diff --git a/tests/test_dints_network.py b/tests/test_dints_network.py
--- a/tests/test_dints_network.py
+++ b/tests/test_dints_network.py
@@ -19,7 +19,7 @@
 
 from monai.networks.nets import DiNTS, TopologyInstance, TopologySearch
 from monai.networks.nets.dints import Cell
-from tests.utils import SkipIfBeforePyTorchVersion, test_script_save
+from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_script_save
 
 TEST_CASES_3D = [
     [
@@ -113,6 +113,7 @@
     ]
 
 
+@skip_if_quick
 class TestDints(unittest.TestCase):
     @parameterized.expand(TEST_CASES_3D + TEST_CASES_2D)
     def test_dints_inference(self, dints_grid_params, dints_params, input_shape, expected_shape):
diff --git a/tests/test_gmm.py b/tests/test_gmm.py
--- a/tests/test_gmm.py
+++ b/tests/test_gmm.py
@@ -22,7 +22,7 @@
 
 from monai._extensions import load_module
 from monai.networks.layers import GaussianMixtureModel
-from tests.utils import skip_if_darwin, skip_if_no_cuda, skip_if_windows
+from tests.utils import skip_if_darwin, skip_if_no_cuda, skip_if_quick, skip_if_windows
 
 TEST_CASES = [
     [
@@ -259,6 +259,7 @@
 ]
 
 
+@skip_if_quick
 class GMMTestCase(unittest.TestCase):
     def setUp(self):
         self._var = os.environ.get("TORCH_EXTENSIONS_DIR")
diff --git a/tests/test_retinanet.py b/tests/test_retinanet.py
--- a/tests/test_retinanet.py
+++ b/tests/test_retinanet.py
@@ -20,7 +20,7 @@
 from monai.networks import eval_mode
 from monai.networks.nets import resnet10, resnet18, resnet34, resnet50, resnet101, resnet152, resnet200
 from monai.utils import ensure_tuple, optional_import
-from tests.utils import SkipIfBeforePyTorchVersion, test_onnx_save, test_script_save
+from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_onnx_save, test_script_save
 
 _, has_torchvision = optional_import("torchvision")
 
@@ -99,6 +99,7 @@
 
 @SkipIfBeforePyTorchVersion((1, 12))
 @unittest.skipUnless(has_torchvision, "Requires torchvision")
+@skip_if_quick
 class TestRetinaNet(unittest.TestCase):
     @parameterized.expand(TEST_CASES)
     def test_retina_shape(self, model, input_param, input_shape):
diff --git a/tests/test_retinanet_detector.py b/tests/test_retinanet_detector.py
--- a/tests/test_retinanet_detector.py
+++ b/tests/test_retinanet_detector.py
@@ -21,7 +21,7 @@
 from monai.apps.detection.utils.anchor_utils import AnchorGeneratorWithAnchorShape
 from monai.networks import eval_mode, train_mode
 from monai.utils import optional_import
-from tests.utils import SkipIfBeforePyTorchVersion, test_script_save
+from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick, test_script_save
 
 _, has_torchvision = optional_import("torchvision")
 
@@ -112,6 +112,7 @@ def forward(self, images):
 
 @SkipIfBeforePyTorchVersion((1, 11))
 @unittest.skipUnless(has_torchvision, "Requires torchvision")
+@skip_if_quick
 class TestRetinaNetDetector(unittest.TestCase):
     @parameterized.expand(TEST_CASES)
     def test_retina_detector_resnet_backbone_shape(self, input_param, input_shape):
diff --git a/tests/test_spacingd.py b/tests/test_spacingd.py
--- a/tests/test_spacingd.py
+++ b/tests/test_spacingd.py
@@ -23,7 +23,7 @@
 from monai.transforms import Spacingd
 from monai.utils import ensure_tuple_rep
 from tests.lazy_transforms_utils import test_resampler_lazy
-from tests.utils import TEST_DEVICES, assert_allclose
+from tests.utils import TEST_DEVICES, assert_allclose, skip_if_quick
 
 TESTS: list[tuple] = []
 for device in TEST_DEVICES:
@@ -134,6 +134,7 @@ def test_orntd_torch(self, init_param, img: torch.Tensor, track_meta: bool, devi
             self.assertNotIsInstance(res, MetaTensor)
             self.assertNotEqual(img.shape, res.shape)
 
+    @skip_if_quick
     def test_space_same_shape(self):
         affine_1 = np.array(
             [
diff --git a/tests/test_trainable_joint_bilateral.py b/tests/test_trainable_joint_bilateral.py
--- a/tests/test_trainable_joint_bilateral.py
+++ b/tests/test_trainable_joint_bilateral.py
@@ -19,7 +19,7 @@
 from torch.autograd import gradcheck
 
 from monai.networks.layers.filtering import TrainableJointBilateralFilterFunction
-from tests.utils import skip_if_no_cpp_extension, skip_if_no_cuda
+from tests.utils import skip_if_no_cpp_extension, skip_if_no_cuda, skip_if_quick
 
 TEST_CASES = [
     [
@@ -356,6 +356,7 @@
 
 
 @skip_if_no_cpp_extension
+@skip_if_quick
 class JointBilateralFilterTestCaseCpuPrecise(unittest.TestCase):
     @parameterized.expand(TEST_CASES)
     def test_cpu_precise(self, test_case_description, sigmas, input, guide, expected):