File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 46
46
args [i ] = f"{ flag } ={ undeclared_output_dir } /{ arg_split [1 ]} "
47
47
48
48
if os .environ .get ("TESTBRIDGE_TEST_ONLY" ):
49
- # TestClass.test_fn -> TestClass::test_fn
50
- module_name = os .environ .get ("TESTBRIDGE_TEST_ONLY" ).replace ("." , "::" )
49
+ test_filter = os .environ ["TESTBRIDGE_TEST_ONLY" ]
51
50
52
51
# If the test filter does not start with a class-like name, then use test filtering instead
53
- # -- test_filter=test_fn
54
- if not module_name [ 0 ]. isupper ():
52
+ if not test_filter [ 0 ]. isupper ():
53
+ # --test_filter=test_module.test_fn or --test_filter=test_module/test_file.py
55
54
pytest_args .extend (args )
56
- pytest_args .append ("-k={filter}" .format (filter = module_name ))
55
+ pytest_args .append ("-k={filter}" .format (filter = test_filter ))
57
56
else :
58
57
# --test_filter=TestClass.test_fn
59
- # Add test filter to path-like args
60
58
for arg in args :
61
59
if not arg .startswith ("--" ):
62
- # Maybe a src file? Add test class/method selection to it. Not sure if this will work if the
63
- # symbol can't be found in the test file.
64
- arg = "{arg}::{module_fn}" .format (arg = arg , module_fn = module_name )
60
+ # arg is a src file. Add test class/method selection to it.
61
+ # test.py::TestClass::test_fn
62
+ arg = "{arg}::{module_fn}" .format (arg = arg , module_fn = test_filter . replace ( "." , "::" ) )
65
63
pytest_args .append (arg )
66
64
else :
67
65
pytest_args .extend (args )
You can’t perform that action at this time.
0 commit comments