MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / test_modules_are_loaded

Method test_modules_are_loaded

test/base/test_utils.py:3576–3604  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3574
3575class TestModuleRegistry(fixtures.TestBase):
3576 def test_modules_are_loaded(self):
3577 to_restore = []
3578 for m in ("xml.dom", "wsgiref.simple_server"):
3579 to_restore.append((m, sys.modules.pop(m, None)))
3580 try:
3581 mr = preloaded._ModuleRegistry()
3582
3583 ret = mr.preload_module(
3584 "xml.dom", "wsgiref.simple_server", "sqlalchemy.sql.util"
3585 )
3586 o = object()
3587 is_(ret(o), o)
3588
3589 is_false(hasattr(mr, "xml_dom"))
3590 mr.import_prefix("xml")
3591 is_true("xml.dom" in sys.modules)
3592 is_(sys.modules["xml.dom"], mr.xml_dom)
3593
3594 is_true("wsgiref.simple_server" not in sys.modules)
3595 mr.import_prefix("wsgiref")
3596 is_true("wsgiref.simple_server" in sys.modules)
3597 is_(sys.modules["wsgiref.simple_server"], mr.wsgiref_simple_server)
3598
3599 mr.import_prefix("sqlalchemy")
3600 is_(sys.modules["sqlalchemy.sql.util"], mr.sql_util)
3601 finally:
3602 for name, mod in to_restore:
3603 if mod is not None:
3604 sys.modules[name] = mod
3605
3606
3607class MethodOveriddenTest(fixtures.TestBase):

Callers

nothing calls this directly

Calls 7

is_Function · 0.90
is_falseFunction · 0.90
is_trueFunction · 0.90
preload_moduleMethod · 0.80
import_prefixMethod · 0.80
appendMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected