From c44b4695bed697ea0be9506158af05c2cc2fee0d Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 11:50:28 +0000 Subject: [PATCH 01/10] adds py311 min tests Signed-off-by: Wenqi Li --- .github/workflows/pythonapp-min.yml | 4 ++-- tests/min_tests.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index ff6f9ce6a0..764e449595 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -74,7 +74,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.7', '3.8', '3.9', '3.10'] + python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] timeout-minutes: 40 steps: - uses: actions/checkout@v3 @@ -101,7 +101,7 @@ jobs: - name: Install the dependencies run: | # min. requirements - python -m pip install torch==1.12.1 + python -m pip install torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions diff --git a/tests/min_tests.py b/tests/min_tests.py index 765cec8adf..103d8aea7d 100644 --- a/tests/min_tests.py +++ b/tests/min_tests.py @@ -210,6 +210,7 @@ def run_testsuit(): from monai.utils.module import load_submodules _, err_mod = load_submodules(sys.modules["monai"], True) + print(err_mod) assert not err_mod # testing all modules From c4383408cb6857a8ce754831e63ffeb484ceccfd Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 08:56:13 -0500 Subject: [PATCH 02/10] fixes type Signed-off-by: Wenqi Li --- monai/engines/multi_gpu_supervised_trainer.py | 4 ++-- monai/engines/workflow.py | 6 +++--- monai/handlers/earlystop_handler.py | 2 +- monai/handlers/lr_schedule_handler.py | 2 +- monai/handlers/metric_logger.py | 2 +- monai/handlers/mlflow_handler.py | 2 +- monai/handlers/nvtx_handlers.py | 4 ++-- monai/handlers/stats_handler.py | 2 +- monai/handlers/tensorboard_handlers.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/monai/engines/multi_gpu_supervised_trainer.py b/monai/engines/multi_gpu_supervised_trainer.py index 0433617649..c744767c1f 100644 --- a/monai/engines/multi_gpu_supervised_trainer.py +++ b/monai/engines/multi_gpu_supervised_trainer.py @@ -31,8 +31,8 @@ from ignite.engine import Engine from ignite.metrics import Metric else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") - Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator") __all__ = ["create_multigpu_supervised_trainer", "create_multigpu_supervised_evaluator"] diff --git a/monai/engines/workflow.py b/monai/engines/workflow.py index bf1d1ef1bf..88868988e2 100644 --- a/monai/engines/workflow.py +++ b/monai/engines/workflow.py @@ -32,9 +32,9 @@ from ignite.engine import Engine, EventEnum from ignite.metrics import Metric else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") - Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric") - EventEnum, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "EventEnum") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator") + EventEnum, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "EventEnum", as_type="decorator") class Workflow(IgniteEngine): # type: ignore[valid-type, misc] # due to optional_import diff --git a/monai/handlers/earlystop_handler.py b/monai/handlers/earlystop_handler.py index 8d57526676..a4b65f69b8 100644 --- a/monai/handlers/earlystop_handler.py +++ b/monai/handlers/earlystop_handler.py @@ -20,7 +20,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") class EarlyStopHandler: diff --git a/monai/handlers/lr_schedule_handler.py b/monai/handlers/lr_schedule_handler.py index db186bd73d..f313ece605 100644 --- a/monai/handlers/lr_schedule_handler.py +++ b/monai/handlers/lr_schedule_handler.py @@ -21,7 +21,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") class LrScheduleHandler: diff --git a/monai/handlers/metric_logger.py b/monai/handlers/metric_logger.py index 350d1978de..57f621f917 100644 --- a/monai/handlers/metric_logger.py +++ b/monai/handlers/metric_logger.py @@ -22,7 +22,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") def _get_loss_from_output(output, loss_key: str = CommonKeys.LOSS): diff --git a/monai/handlers/mlflow_handler.py b/monai/handlers/mlflow_handler.py index 664a1c8730..0f4aa75279 100644 --- a/monai/handlers/mlflow_handler.py +++ b/monai/handlers/mlflow_handler.py @@ -22,7 +22,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") DEFAULT_TAG = "Loss" diff --git a/monai/handlers/nvtx_handlers.py b/monai/handlers/nvtx_handlers.py index 66462a698c..bc7b7d5a8b 100644 --- a/monai/handlers/nvtx_handlers.py +++ b/monai/handlers/nvtx_handlers.py @@ -21,8 +21,8 @@ if TYPE_CHECKING: from ignite.engine import Engine, Events else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") - Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events", as_type="decorator") __all__ = ["RangeHandler", "RangePushHandler", "RangePopHandler", "MarkHandler"] diff --git a/monai/handlers/stats_handler.py b/monai/handlers/stats_handler.py index e3b5de2d36..93aad8cbc2 100644 --- a/monai/handlers/stats_handler.py +++ b/monai/handlers/stats_handler.py @@ -22,7 +22,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") DEFAULT_KEY_VAL_FORMAT = "{}: {:.4f} " DEFAULT_TAG = "Loss" diff --git a/monai/handlers/tensorboard_handlers.py b/monai/handlers/tensorboard_handlers.py index 445e3e76ca..893ee1f5ff 100644 --- a/monai/handlers/tensorboard_handlers.py +++ b/monai/handlers/tensorboard_handlers.py @@ -25,7 +25,7 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine") + Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") DEFAULT_TAG = "Loss" From 3d084b823652367d7890f5bbb83fd7d56996a1cb Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 08:57:44 -0500 Subject: [PATCH 03/10] update ver Signed-off-by: Wenqi Li --- .github/workflows/pythonapp-min.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 764e449595..a341a7a88a 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -101,7 +101,7 @@ jobs: - name: Install the dependencies run: | # min. requirements - python -m pip install torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu + python -m pip install torch --extra-index-url https://download.pytorch.org/whl/cpu python -m pip install -r requirements-min.txt python -m pip list BUILD_MONAI=0 python setup.py develop # no compile of extensions From 8a633b6389f698b1eded7806f78caee02ec8b7e8 Mon Sep 17 00:00:00 2001 From: monai-bot Date: Mon, 7 Nov 2022 14:03:51 +0000 Subject: [PATCH 04/10] [MONAI] code formatting Signed-off-by: monai-bot --- monai/engines/multi_gpu_supervised_trainer.py | 8 ++++++-- monai/engines/workflow.py | 12 +++++++++--- monai/handlers/earlystop_handler.py | 4 +++- monai/handlers/lr_schedule_handler.py | 4 +++- monai/handlers/metric_logger.py | 4 +++- monai/handlers/mlflow_handler.py | 4 +++- monai/handlers/nvtx_handlers.py | 8 ++++++-- monai/handlers/stats_handler.py | 4 +++- monai/handlers/tensorboard_handlers.py | 4 +++- 9 files changed, 39 insertions(+), 13 deletions(-) diff --git a/monai/engines/multi_gpu_supervised_trainer.py b/monai/engines/multi_gpu_supervised_trainer.py index c744767c1f..a9171d0f50 100644 --- a/monai/engines/multi_gpu_supervised_trainer.py +++ b/monai/engines/multi_gpu_supervised_trainer.py @@ -31,8 +31,12 @@ from ignite.engine import Engine from ignite.metrics import Metric else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") - Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) + Metric, _ = optional_import( + "ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator" + ) __all__ = ["create_multigpu_supervised_trainer", "create_multigpu_supervised_evaluator"] diff --git a/monai/engines/workflow.py b/monai/engines/workflow.py index 88868988e2..28f2430a87 100644 --- a/monai/engines/workflow.py +++ b/monai/engines/workflow.py @@ -32,9 +32,15 @@ from ignite.engine import Engine, EventEnum from ignite.metrics import Metric else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") - Metric, _ = optional_import("ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator") - EventEnum, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "EventEnum", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) + Metric, _ = optional_import( + "ignite.metrics", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Metric", as_type="decorator" + ) + EventEnum, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "EventEnum", as_type="decorator" + ) class Workflow(IgniteEngine): # type: ignore[valid-type, misc] # due to optional_import diff --git a/monai/handlers/earlystop_handler.py b/monai/handlers/earlystop_handler.py index a4b65f69b8..4f61fa3e00 100644 --- a/monai/handlers/earlystop_handler.py +++ b/monai/handlers/earlystop_handler.py @@ -20,7 +20,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) class EarlyStopHandler: diff --git a/monai/handlers/lr_schedule_handler.py b/monai/handlers/lr_schedule_handler.py index f313ece605..66059bba95 100644 --- a/monai/handlers/lr_schedule_handler.py +++ b/monai/handlers/lr_schedule_handler.py @@ -21,7 +21,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) class LrScheduleHandler: diff --git a/monai/handlers/metric_logger.py b/monai/handlers/metric_logger.py index 57f621f917..334f631b88 100644 --- a/monai/handlers/metric_logger.py +++ b/monai/handlers/metric_logger.py @@ -22,7 +22,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) def _get_loss_from_output(output, loss_key: str = CommonKeys.LOSS): diff --git a/monai/handlers/mlflow_handler.py b/monai/handlers/mlflow_handler.py index 0f4aa75279..060738df36 100644 --- a/monai/handlers/mlflow_handler.py +++ b/monai/handlers/mlflow_handler.py @@ -22,7 +22,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) DEFAULT_TAG = "Loss" diff --git a/monai/handlers/nvtx_handlers.py b/monai/handlers/nvtx_handlers.py index bc7b7d5a8b..19f1b2e2bb 100644 --- a/monai/handlers/nvtx_handlers.py +++ b/monai/handlers/nvtx_handlers.py @@ -21,8 +21,12 @@ if TYPE_CHECKING: from ignite.engine import Engine, Events else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") - Events, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) + Events, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Events", as_type="decorator" + ) __all__ = ["RangeHandler", "RangePushHandler", "RangePopHandler", "MarkHandler"] diff --git a/monai/handlers/stats_handler.py b/monai/handlers/stats_handler.py index 93aad8cbc2..9fdf5eeb9f 100644 --- a/monai/handlers/stats_handler.py +++ b/monai/handlers/stats_handler.py @@ -22,7 +22,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) DEFAULT_KEY_VAL_FORMAT = "{}: {:.4f} " DEFAULT_TAG = "Loss" diff --git a/monai/handlers/tensorboard_handlers.py b/monai/handlers/tensorboard_handlers.py index 893ee1f5ff..14701e79d9 100644 --- a/monai/handlers/tensorboard_handlers.py +++ b/monai/handlers/tensorboard_handlers.py @@ -25,7 +25,9 @@ if TYPE_CHECKING: from ignite.engine import Engine else: - Engine, _ = optional_import("ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator") + Engine, _ = optional_import( + "ignite.engine", IgniteInfo.OPT_IMPORT_VERSION, min_version, "Engine", as_type="decorator" + ) DEFAULT_TAG = "Loss" From 84f4886cbc9a880c731b8609b559b5b381d0d8b3 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 14:15:59 +0000 Subject: [PATCH 05/10] nightly build Signed-off-by: Wenqi Li --- .github/workflows/pythonapp-min.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index a341a7a88a..be2ded0113 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -98,6 +98,9 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} + - name: install prerelease and py311 + if: matrix.python-version == '3.11' + run: pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu - name: Install the dependencies run: | # min. requirements From aa0b252aa311bf2d782c8b267e9146689598d649 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 11:47:50 -0500 Subject: [PATCH 06/10] skip py311 jit Signed-off-by: Wenqi Li --- tests/utils.py | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index b16b4b13fb..600c83a1d0 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -697,16 +697,21 @@ def test_script_save(net, *inputs, device=None, rtol=1e-4, atol=0.0): """ # TODO: would be nice to use GPU if available, but it currently causes CI failures. device = "cpu" - with tempfile.TemporaryDirectory() as tempdir: - convert_to_torchscript( - model=net, - filename_or_obj=os.path.join(tempdir, "model.ts"), - verify=True, - inputs=inputs, - device=device, - rtol=rtol, - atol=atol, - ) + try: + with tempfile.TemporaryDirectory() as tempdir: + convert_to_torchscript( + model=net, + filename_or_obj=os.path.join(tempdir, "model.ts"), + verify=True, + inputs=inputs, + device=device, + rtol=rtol, + atol=atol, + ) + except (RuntimeError, AttributeError): + if sys.version_info.minor == 11 and sys.version_info.major == 3: + warnings.warn('skipping py 3.11') + return def download_url_or_skip_test(*args, **kwargs): From 690e4b74a0f465e6e9cfe082e0c2a5d7859e0fa5 Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 18:01:36 +0000 Subject: [PATCH 07/10] stable Signed-off-by: Wenqi Li --- .github/workflows/pythonapp-min.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pythonapp-min.yml b/.github/workflows/pythonapp-min.yml index 4ea35398d5..317fcbbcd2 100644 --- a/.github/workflows/pythonapp-min.yml +++ b/.github/workflows/pythonapp-min.yml @@ -99,9 +99,6 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: ubuntu-latest-latest-pip-${{ steps.pip-cache.outputs.datew }} - - name: install prerelease and py311 - if: matrix.python-version == '3.11' - run: pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/cpu - name: Install the dependencies run: | # min. requirements From 9741961d0e7d7d86356c77a2135505b5a92ff3cf Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 18:12:11 +0000 Subject: [PATCH 08/10] tests Signed-off-by: Wenqi Li --- tests/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/utils.py b/tests/utils.py index bfaa3596d4..b094f59ff8 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -708,6 +708,7 @@ def test_script_save(net, *inputs, device=None, rtol=1e-4, atol=0.0): rtol=rtol, atol=atol, ) + assert sys.version_info.minor != 11, "expecting jit + Python 3.11 not working yet" except (RuntimeError, AttributeError): if sys.version_info.minor == 11 and sys.version_info.major == 3: warnings.warn("skipping py 3.11") From cb077684f00566507c1b0ad0e70ea984e2c836bb Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Mon, 7 Nov 2022 18:23:26 +0000 Subject: [PATCH 09/10] Revert "tests" This reverts commit 9741961d0e7d7d86356c77a2135505b5a92ff3cf. Signed-off-by: Wenqi Li --- tests/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/utils.py b/tests/utils.py index b094f59ff8..bfaa3596d4 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -708,7 +708,6 @@ def test_script_save(net, *inputs, device=None, rtol=1e-4, atol=0.0): rtol=rtol, atol=atol, ) - assert sys.version_info.minor != 11, "expecting jit + Python 3.11 not working yet" except (RuntimeError, AttributeError): if sys.version_info.minor == 11 and sys.version_info.major == 3: warnings.warn("skipping py 3.11") From 5dbc7f15d23fc11569868b0e7d4a4494e1478ebd Mon Sep 17 00:00:00 2001 From: Wenqi Li Date: Tue, 8 Nov 2022 11:59:14 +0000 Subject: [PATCH 10/10] update based on comments Signed-off-by: Wenqi Li --- tests/min_tests.py | 3 +-- tests/utils.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/min_tests.py b/tests/min_tests.py index 103d8aea7d..5bbc086adf 100644 --- a/tests/min_tests.py +++ b/tests/min_tests.py @@ -210,8 +210,7 @@ def run_testsuit(): from monai.utils.module import load_submodules _, err_mod = load_submodules(sys.modules["monai"], True) - print(err_mod) - assert not err_mod + assert not err_mod, f"err_mod={err_mod} not empty" # testing all modules test_runner = unittest.TextTestRunner(stream=sys.stdout, verbosity=2) diff --git a/tests/utils.py b/tests/utils.py index e11ba5139b..afe08e0bfa 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -710,7 +710,7 @@ def test_script_save(net, *inputs, device=None, rtol=1e-4, atol=0.0): atol=atol, ) except (RuntimeError, AttributeError): - if sys.version_info.minor == 11 and sys.version_info.major == 3: + if sys.version_info.major == 3 and sys.version_info.minor == 11: warnings.warn("skipping py 3.11") return