1111
1212from __future__ import annotations
1313
14+ from pathlib import Path
1415import json
1516import os
1617import tempfile
2324from monai .networks import save_state
2425from tests .test_utils import command_line_tests , skip_if_windows
2526
27+ TESTS_PATH = Path (__file__ ).parents [1 ]
28+
2629TEST_CASE_1 = ["" , "" ]
2730
2831TEST_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