def test_pytest_fail_notrace_collection(pytester: Pytester) -> None:
    """Test pytest.fail(..., pytrace=False) does not show tracebacks during collection."""
    pytester.makepyfile(
        """
        import pytest
        def some_internal_function():
            pytest.fail("hello", pytrace=False)
        some_internal_function()
    """
    )
    result = pytester.runpytest()
    result.stdout.fnmatch_lines(["hello"])
    result.stdout.no_fnmatch_line("*def some_internal_function()*")
Test pytest.fail(..., pytrace=False) does not show tracebacks during collection.
testing/test_runner.py