def test_importorskip_custom_reason(pytester: Pytester) -> None:
    """Make sure custom reasons are used."""
    pytester.makepyfile(
        """
        import pytest
        foobarbaz = pytest.importorskip("foobarbaz2", reason="just because")

        def test_foo():
            pass
    """
    )
    result = pytester.runpytest("-ra")
    result.stdout.fnmatch_lines(["*just because*"])
    result.stdout.fnmatch_lines(["*collected 0 items / 1 skipped*"])
Make sure custom reasons are used.
testing/test_runner.py