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

Method test_forget

Lib/test/test_support.py:146–161  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 self.assertFalse(os.path.exists(dirpath))
145
146 def test_forget(self):
147 mod_filename = TESTFN + '.py'
148 with open(mod_filename, 'w', encoding="utf-8") as f:
149 print('foo = 1', file=f)
150 sys.path.insert(0, os.curdir)
151 importlib.invalidate_caches()
152 try:
153 mod = __import__(TESTFN)
154 self.assertIn(TESTFN, sys.modules)
155
156 import_helper.forget(TESTFN)
157 self.assertNotIn(TESTFN, sys.modules)
158 finally:
159 del sys.path[0]
160 os_helper.unlink(mod_filename)
161 os_helper.rmtree('__pycache__')
162
163 @support.requires_working_socket()
164 def test_HOST(self):

Callers

nothing calls this directly

Calls 8

__import__Function · 0.85
assertInMethod · 0.80
assertNotInMethod · 0.80
openFunction · 0.50
insertMethod · 0.45
invalidate_cachesMethod · 0.45
forgetMethod · 0.45
unlinkMethod · 0.45

Tested by

no test coverage detected