From 3515dd4df556d9568ca0e8a69e91f02697902079 Mon Sep 17 00:00:00 2001 From: ytl0623 Date: Mon, 24 Nov 2025 17:06:48 +0800 Subject: [PATCH 1/2] Added an optional_import check for onnxruntime and applied the @unittest.skipUnless decorator to the test_onnx method. Signed-off-by: ytl0623 --- tests/apps/detection/networks/test_retinanet.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/apps/detection/networks/test_retinanet.py b/tests/apps/detection/networks/test_retinanet.py index cb4129f7ed..1cf77e7492 100644 --- a/tests/apps/detection/networks/test_retinanet.py +++ b/tests/apps/detection/networks/test_retinanet.py @@ -23,6 +23,7 @@ from tests.test_utils import dict_product, skip_if_quick, test_onnx_save, test_script_save _, has_torchvision = optional_import("torchvision") +_, has_onnxruntime = optional_import("onnxruntime") device = "cuda" if torch.cuda.is_available() else "cpu" num_anchors = 7 @@ -169,6 +170,7 @@ def test_script(self, model, input_param, input_shape): test_script_save(net, data) @parameterized.expand(TEST_CASES_TS) + @unittest.skipUnless(has_onnxruntime, "onnxruntime not installed") def test_onnx(self, model, input_param, input_shape): try: idx = int(self.id().split("test_onnx_")[-1]) @@ -203,4 +205,4 @@ def test_onnx(self, model, input_param, input_shape): if __name__ == "__main__": - unittest.main() + unittest.main() \ No newline at end of file From 324b370d1773420d2dbc1e34691fc669dca74e2a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 09:08:03 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/apps/detection/networks/test_retinanet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/apps/detection/networks/test_retinanet.py b/tests/apps/detection/networks/test_retinanet.py index 1cf77e7492..3f4721a755 100644 --- a/tests/apps/detection/networks/test_retinanet.py +++ b/tests/apps/detection/networks/test_retinanet.py @@ -205,4 +205,4 @@ def test_onnx(self, model, input_param, input_shape): if __name__ == "__main__": - unittest.main() \ No newline at end of file + unittest.main()