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

Function test_importorskip_dev_module

testing/test_runner.py:877–887  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

875
876
877def test_importorskip_dev_module(monkeypatch) -> None:
878 try:
879 mod = types.ModuleType("mockmodule")
880 mod.__version__ = "0.13.0.dev-43290" # type: ignore
881 monkeypatch.setitem(sys.modules, "mockmodule", mod)
882 mod2 = pytest.importorskip("mockmodule", minversion="0.12.0")
883 assert mod2 == mod
884 with pytest.raises(pytest.skip.Exception):
885 pytest.importorskip("mockmodule1", minversion="0.14.0")
886 except pytest.skip.Exception: # pragma: no cover
887 assert False, f"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

Used in the wild real call sites across dependent graphs

searching dependent graphs…