Skip to content

Commit e7e48ae

Browse files
committed
Fixes more wrong paths
1 parent fbbcafc commit e7e48ae

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

tests/integration/test_integration_bundle_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def test_tiny(self):
6868
with open(config_file, "w") as f:
6969
json.dump(
7070
{
71-
"trainer": {"_target_": "tests.test_integration_bundle_run._Runnable42", "val": 42},
71+
"trainer": {"_target_": "tests.integration.test_integration_bundle_run._Runnable42", "val": 42},
7272
# keep this test case to cover the "run_id" arg
7373
"training": "[email protected]()",
7474
},

tests/networks/nets/test_efficientnet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from monai.utils import optional_import
3232
from tests.test_utils import skip_if_downloading_fails, skip_if_quick, test_pretrained_networks, test_script_save
3333

34-
TESTS_PATH = Path(__file__).parents[1]
34+
TESTS_PATH = Path(__file__).parents[2]
3535

3636
if TYPE_CHECKING:
3737
import torchvision

tests/networks/nets/test_senet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def setUp(self):
8787
if "certificate" in str(rt_e): # [SSL: CERTIFICATE_VERIFY_FAILED]
8888
replace_url = True
8989
if replace_url:
90-
testing_dir = Path(__file__).parents[1] / "testing_data"
90+
testing_dir = Path(__file__).parents[2] / "testing_data"
9191
testing_data_urls = {
9292
"senet154": {
9393
"url": testing_data_config("models", "senet154-c7b49a05", "url"),

tests/networks/test_bundle_onnx_export.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def tearDown(self):
4343

4444
@parameterized.expand([TEST_CASE_1, TEST_CASE_2])
4545
def test_onnx_export(self, use_trace):
46-
tests_path = Path(__file__).parents[1]
46+
tests_path = Path(__file__).parents[2]
4747
meta_file = os.path.join(tests_path, "testing_data", "metadata.json")
4848
config_file = os.path.join(tests_path, "testing_data", "inference.json")
4949
with tempfile.TemporaryDirectory() as tempdir:

tests/runner.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def stopTest(self, test): # noqa: N802
4545
name = self.getDescription(test)
4646
self.stream.write(f"Finished test: {name} ({elapsed:.03}s)\n")
4747
if name in results:
48-
raise AssertionError("expected all keys to be unique")
48+
raise AssertionError(f"expected all keys to be unique, but {name} is duplicated")
4949
results[name] = elapsed
5050
super().stopTest(test)
5151

@@ -129,13 +129,10 @@ def get_default_pattern(loader):
129129
file.relative_to(tests_path).as_posix().replace("/", ".").replace(".py", "")
130130
for file in tests_path.rglob("test_*.py")
131131
}
132-
# import pdb
133-
# pdb.set_trace()
134-
135132
cases = []
136133
for test_module in files:
137134
if re.match(args.pattern, test_module):
138-
cases.append(f"{test_module}")
135+
cases.append(test_module)
139136
else:
140137
print(f"monai test runner: excluding {test_module}")
141138
print(cases)
@@ -146,7 +143,8 @@ def get_default_pattern(loader):
146143
test_runner = unittest.runner.TextTestRunner(
147144
resultclass=TimeLoggingTestResult, verbosity=args.verbosity, failfast=args.failfast
148145
)
149-
146+
import pdb
147+
pdb.set_trace()
150148
# Use try catches to print the current results if encountering exception or keyboard interruption
151149
try:
152150
test_result = test_runner.run(tests)

0 commit comments

Comments
 (0)