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

Method tearDown

Lib/test/test_pkg.py:54–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

52 self.modules_to_cleanup = set() # Populated by mkhier().
53
54 def tearDown(self):
55 sys.path[:] = self.syspath
56 for modulename in self.modules_to_cleanup:
57 if modulename in sys.modules:
58 del sys.modules[modulename]
59 if self.root: # Only clean if the test was actually run
60 cleanout(self.root)
61
62 # delete all modules concerning the tested hierarchy
63 if self.pkgname:
64 modules = [name for name in sys.modules
65 if self.pkgname in name.split('.')]
66 for name in modules:
67 del sys.modules[name]
68
69 def run_code(self, code):
70 exec(textwrap.dedent(code), globals(), {"self": self})

Callers

nothing calls this directly

Calls 2

cleanoutFunction · 0.85
splitMethod · 0.45

Tested by

no test coverage detected