diff --git a/testing/test_runner.py b/testing/test_runner.py index 8cc496f70..ed5a0f80e 100644 --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -1094,3 +1094,20 @@ def test_outcome_exception_bad_msg() -> None: with pytest.raises(TypeError) as excinfo: OutcomeException(func) # type: ignore assert str(excinfo.value) == expected + + +def test_pytest_version(pytester: Pytester, monkeypatch: MonkeyPatch) -> None: + pytester.makepyfile( + """ + import pytest + import os + + + def test(): + assert os.environ.get("PYTEST_VERSION") == pytest.__version__ + """ + ) + result = pytester.runpytest_inprocess() + # assert result.ret == 0 + assert result.ret == ExitCode.OK + assert "PYTEST_VERSION" not in os.environ