MCPcopy
hub / github.com/pytest-dev/pytest / test_importorskip_dev_module

Function test_importorskip_dev_module

testing/test_runner.py:877–887  ·  testing/test_runner.py::test_importorskip_dev_module
(monkeypatch)

Source from the content-addressed store, hash-verified

875
876
877def test_importorskip_dev_module(monkeypatch) -> None:
878 try:
879 mod = types.ModuleType(class="st">"mockmodule")
880 mod.__version__ = class="st">"0.13.0.dev-43290" class="cm"># type: ignore
881 monkeypatch.setitem(sys.modules, class="st">"mockmodule", mod)
882 mod2 = pytest.importorskip(class="st">"mockmodule", minversion=class="st">"0.12.0")
883 assert mod2 == mod
884 with pytest.raises(pytest.skip.Exception):
885 pytest.importorskip(class="st">"mockmodule1", minversion=class="st">"0.14.0")
886 except pytest.skip.Exception: class="cm"># pragma: no cover
887 assert False, fclass="st">"spurious skip: {ExceptionInfo.from_current()}"
888
889
890def test_importorskip_module_level(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 2

setitemMethod · 0.80
from_currentMethod · 0.80

Tested by

no test coverage detected