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

Function test_importorskip_custom_reason

testing/test_runner.py:764–777  ·  view source on GitHub ↗

Make sure custom reasons are used.

(pytester: Pytester)

Source from the content-addressed store, hash-verified

762
763
764def test_importorskip_custom_reason(pytester: Pytester) -> None:
765 """Make sure custom reasons are used."""
766 pytester.makepyfile(
767 """
768 import pytest
769 foobarbaz = pytest.importorskip("foobarbaz2", reason="just because")
770
771 def test_foo():
772 pass
773 """
774 )
775 result = pytester.runpytest("-ra")
776 result.stdout.fnmatch_lines(["*just because*"])
777 result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"])
778
779
780def test_pytest_cmdline_main(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

fnmatch_linesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected