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

Method test_module_missing_spec

Lib/test/test_importlib/test_api.py:339–349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

337 self.assertIs(reloaded, ham)
338
339 def test_module_missing_spec(self):
340 #Test that reload() throws ModuleNotFounderror when reloading
341 # a module whose missing a spec. (bpo-29851)
342 name = 'spam'
343 with test_util.uncache(name):
344 module = sys.modules[name] = types.ModuleType(name)
345 # Sanity check by attempting an import.
346 module = self.init.import_module(name)
347 self.assertIsNone(module.__spec__)
348 with self.assertRaises(ModuleNotFoundError):
349 self.init.reload(module)
350
351 def test_reload_traceback_with_non_str(self):
352 # gh-125519

Callers

nothing calls this directly

Calls 4

assertIsNoneMethod · 0.80
import_moduleMethod · 0.45
assertRaisesMethod · 0.45
reloadMethod · 0.45

Tested by

no test coverage detected