MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_modules_are_loaded

Method test_modules_are_loaded

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

Source from the content-addressed store, hash-verified

3607
3608class TestModuleRegistry(fixtures.TestBase):
3609 def test_modules_are_loaded(self):
3610 to_restore = []
3611 for m in ("xml.dom", "wsgiref.simple_server"):
3612 to_restore.append((m, sys.modules.pop(m, None)))
3613 try:
3614 mr = preloaded._ModuleRegistry()
3615
3616 ret = mr.preload_module(
3617 "xml.dom", "wsgiref.simple_server", "sqlalchemy.sql.util"
3618 )
3619 o = object()
3620 is_(ret(o), o)
3621
3622 is_false(hasattr(mr, "xml_dom"))
3623 mr.import_prefix("xml")
3624 is_true("xml.dom" in sys.modules)
3625 is_(sys.modules["xml.dom"], mr.xml_dom)
3626
3627 is_true("wsgiref.simple_server" not in sys.modules)
3628 mr.import_prefix("wsgiref")
3629 is_true("wsgiref.simple_server" in sys.modules)
3630 is_(sys.modules["wsgiref.simple_server"], mr.wsgiref_simple_server)
3631
3632 mr.import_prefix("sqlalchemy")
3633 is_(sys.modules["sqlalchemy.sql.util"], mr.sql_util)
3634 finally:
3635 for name, mod in to_restore:
3636 if mod is not None:
3637 sys.modules[name] = mod
3638
3639
3640class 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