MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_importorskip_dev_module

Function test_importorskip_dev_module

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

Source from the content-addressed store, hash-verified

734
735
736def test_importorskip_dev_module(monkeypatch) -> None:
737 try:
738 mod = types.ModuleType("mockmodule")
739 mod.__version__ = "0.13.0.dev-43290" # type: ignore
740 monkeypatch.setitem(sys.modules, "mockmodule", mod)
741 mod2 = pytest.importorskip("mockmodule", minversion="0.12.0")
742 assert mod2 == mod
743 with pytest.raises(pytest.skip.Exception):
744 pytest.importorskip("mockmodule1", minversion="0.14.0")
745 except pytest.skip.Exception: # pragma: no cover
746 assert False, f"spurious skip: {ExceptionInfo.from_current()}"
747
748
749def 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