MCPcopy Index your code
hub / github.com/python/cpython / test_unload_tests

Method test_unload_tests

Lib/test/test_regrtest.py:2213–2230  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2211 stats=len(tests), parallel=True)
2212
2213 def test_unload_tests(self):
2214 # Test that unloading test modules does not break tests
2215 # that import from other tests.
2216 # The test execution order matters for this test.
2217 # Both test_regrtest_a and test_regrtest_c which are executed before
2218 # and after test_regrtest_b import a submodule from the test_regrtest_b
2219 # package and use it in testing. test_regrtest_b itself does not import
2220 # that submodule.
2221 # Previously test_regrtest_c failed because test_regrtest_b.util in
2222 # sys.modules was left after test_regrtest_a (making the import
2223 # statement no-op), but new test_regrtest_b without the util attribute
2224 # was imported for test_regrtest_b.
2225 testdir = os.path.join(os.path.dirname(__file__),
2226 'regrtestdata', 'import_from_tests')
2227 tests = [f'test_regrtest_{name}' for name in ('a', 'b', 'c')]
2228 args = ['-Wd', '-E', '-bb', '-m', 'test', '--testdir=%s' % testdir, *tests]
2229 output = self.run_python(args)
2230 self.check_executed_tests(output, tests, stats=3)
2231
2232 def check_add_python_opts(self, option):
2233 # --fast-ci and --slow-ci add "-u -W default -bb -E" options to Python

Callers

nothing calls this directly

Calls 4

check_executed_testsMethod · 0.80
joinMethod · 0.45
dirnameMethod · 0.45
run_pythonMethod · 0.45

Tested by

no test coverage detected