File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646 args [i ] = f"{ flag } ={ undeclared_output_dir } /{ arg_split [1 ]} "
4747
4848 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" ]
5150
5251 # 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
5554 pytest_args .extend (args )
56- pytest_args .append ("-k={filter}" .format (filter = module_name ))
55+ pytest_args .append ("-k={filter}" .format (filter = test_filter ))
5756 else :
5857 # --test_filter=TestClass.test_fn
59- # Add test filter to path-like args
6058 for arg in args :
6159 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 ( "." , "::" ) )
6563 pytest_args .append (arg )
6664 else :
6765 pytest_args .extend (args )
You can’t perform that action at this time.
0 commit comments