skip test if no downloading
@@ -21,7 +21,7 @@ from monai.apps.auto3dseg import AutoRunner
from monai.bundle.config_parser import ConfigParser
from monai.data import create_test_image_3d
from monai.utils import optional_import
-from tests.utils import SkipIfBeforePyTorchVersion, skip_if_no_cuda, skip_if_quick
+from tests.utils import SkipIfBeforePyTorchVersion, skip_if_downloading_fails, skip_if_no_cuda, skip_if_quick
_, has_tb = optional_import("torch.utils.tensorboard", name="SummaryWriter")
_, has_nni = optional_import("nni")
@@ -104,11 +104,12 @@ class TestAutoRunner(unittest.TestCase):
runner = AutoRunner(work_dir=work_dir, input=self.data_src_cfg)
runner.set_training_params(train_param) # 2 epochs
runner.set_num_fold(1)
+ with skip_if_downloading_fails():
runner.run()
@skip_if_no_cuda
+ @unittest.skipIf(not has_nni, "nni required")
def test_autorunner_hpo(self) -> None:
- if has_nni:
work_dir = os.path.join(self.test_path, "work_dir")
runner = AutoRunner(work_dir=work_dir, input=self.data_src_cfg, hpo=True)
hpo_param = {
@@ -133,6 +134,7 @@ class TestAutoRunner(unittest.TestCase):
runner.set_num_fold(1)
runner.set_nni_search_space(search_space)
runner.set_hpo_params(params=hpo_param)
+ with skip_if_downloading_fails():
runner.run()
def tearDown(self) -> None:
