Skip to content

Commit 48b4ef2

Browse files
committed
Fix test paths in test_bundle_ckpt_export.py
1 parent 70966c0 commit 48b4ef2

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/bundle/test_bundle_ckpt_export.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from __future__ import annotations
1313

14+
from pathlib import Path
1415
import json
1516
import os
1617
import tempfile
@@ -23,6 +24,8 @@
2324
from monai.networks import save_state
2425
from tests.test_utils import command_line_tests, skip_if_windows
2526

27+
TESTS_PATH = Path(__file__).parents[1]
28+
2629
TEST_CASE_1 = ["", ""]
2730

2831
TEST_CASE_2 = ["model", ""]
@@ -46,8 +49,8 @@ def tearDown(self):
4649

4750
@parameterized.expand([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3])
4851
def test_export(self, key_in_ckpt, use_trace):
49-
meta_file = os.path.join(os.path.dirname(__file__), "testing_data", "metadata.json")
50-
config_file = os.path.join(os.path.dirname(__file__), "testing_data", "inference.json")
52+
meta_file = os.path.join(TESTS_PATH, "testing_data", "metadata.json")
53+
config_file = os.path.join(TESTS_PATH, "testing_data", "inference.json")
5154
with tempfile.TemporaryDirectory() as tempdir:
5255
def_args = {"meta_file": "will be replaced by `meta_file` arg"}
5356
def_args_file = os.path.join(tempdir, "def_args.yaml")
@@ -78,7 +81,7 @@ def test_export(self, key_in_ckpt, use_trace):
7881

7982
@parameterized.expand([TEST_CASE_1, TEST_CASE_2, TEST_CASE_3])
8083
def test_default_value(self, key_in_ckpt, use_trace):
81-
config_file = os.path.join(os.path.dirname(__file__), "testing_data", "inference.json")
84+
config_file = os.path.join(TESTS_PATH, "testing_data", "inference.json")
8285
with tempfile.TemporaryDirectory() as tempdir:
8386
def_args = {"meta_file": "will be replaced by `meta_file` arg"}
8487
def_args_file = os.path.join(tempdir, "def_args.yaml")

0 commit comments

Comments
 (0)