`importorskip` must be able to skip entire modules when used at module level.
(pytester: Pytester)
| 747 | |
| 748 | |
| 749 | def test_importorskip_module_level(pytester: Pytester) -> None: |
| 750 | """`importorskip` must be able to skip entire modules when used at module level.""" |
| 751 | pytester.makepyfile( |
| 752 | """ |
| 753 | import pytest |
| 754 | foobarbaz = pytest.importorskip("foobarbaz") |
| 755 | |
| 756 | def test_foo(): |
| 757 | pass |
| 758 | """ |
| 759 | ) |
| 760 | result = pytester.runpytest() |
| 761 | result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"]) |
| 762 | |
| 763 | |
| 764 | def test_importorskip_custom_reason(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected