def test_shouldstop_is_sticky(pytester: Pytester) -> None:
    """Test that session.shouldstop cannot be reset to False after being set.

    Issue #11706.
    """
    pytester.makeconftest(
        """
        def pytest_sessionfinish(session):
            assert session.shouldstop
            session.shouldstop = False
            assert session.shouldstop
        """
    )
    pytester.makepyfile(
        """
        import pytest

        def test_foo():
            pytest.fail("This is a failing test")

        def test_bar(): pass
        """
    )

    result = pytester.runpytest("--stepwise", "-Wall")

    result.assert_outcomes(failed=1, warnings=1)
    result.stdout.fnmatch_lines("*session.shouldstop cannot be unset*")
Test that session.shouldstop cannot be reset to False after being set.

    Issue #11706.
    
testing/test_session.py