File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change 1212from __future__ import annotations
1313
1414import argparse
15- import glob
15+ from pathlib import Path
1616import inspect
1717import os
1818import re
@@ -124,11 +124,18 @@ def get_default_pattern(loader):
124124 # Get all test names (optionally from some path with some pattern)
125125 with PerfContext () as pc :
126126 # the files are searched from `tests/` folder, starting with `test_`
127- files = glob .glob (os .path .join (os .path .dirname (__file__ ), "test_*.py" ))
127+ tests_path = Path (__file__ ).parent / args .path
128+ files = {
129+ file .relative_to (tests_path ).as_posix ().replace ("/" , "." ).replace (".py" , "" )
130+ for file in tests_path .rglob ("test_*.py" )
131+ }
132+ # import pdb
133+ # pdb.set_trace()
134+
128135 cases = []
129- for test_module in { os . path . basename ( f )[: - 3 ] for f in files } :
136+ for test_module in files :
130137 if re .match (args .pattern , test_module ):
131- cases .append (f"tests. { test_module } " )
138+ cases .append (f"{ test_module } " )
132139 else :
133140 print (f"monai test runner: excluding tests.{ test_module } " )
134141 print (cases )
You can’t perform that action at this time.
0 commit comments