MCPcopy Index your code
hub / github.com/RustPython/RustPython / normalize_test_name

Function normalize_test_name

Lib/test/libregrtest/utils.py:533–552  ·  view source on GitHub ↗
(test_full_name: str, *,
                        is_error: bool = False)

Source from the content-addressed store, hash-verified

531))
532
533def normalize_test_name(test_full_name: str, *,
534 is_error: bool = False) -> str | None:
535 short_name = test_full_name.split(" ")[0]
536 if is_error and short_name in _TEST_LIFECYCLE_HOOKS:
537 if test_full_name.startswith(('setUpModule (', 'tearDownModule (')):
538 # if setUpModule() or tearDownModule() failed, don't filter
539 # tests with the test file name, don't use filters.
540 return None
541
542 # This means that we have a failure in a life-cycle hook,
543 # we need to rerun the whole module or class suite.
544 # Basically the error looks like this:
545 # ERROR: setUpClass (test.test_reg_ex.RegTest)
546 # or
547 # ERROR: setUpModule (test.test_reg_ex)
548 # So, we need to parse the class / module name.
549 lpar = test_full_name.index('(')
550 rpar = test_full_name.index(')')
551 return test_full_name[lpar + 1: rpar].split('.')[-1]
552 return short_name
553
554
555def adjust_rlimit_nofile() -> None:

Callers 1

get_rerun_match_testsMethod · 0.85

Calls 3

splitMethod · 0.45
startswithMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected