Added ut to make sure PYTEST_VERSION is added and removed from env properly
This commit is contained in:
parent
c3e8ec8989
commit
6bb894a521
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue