Apply suggestions from code review
Co-authored-by: Bruno Oliveira <bruno@soliv.dev>
This commit is contained in:
parent
dff74a9bf4
commit
237ea1ac23
|
@ -1 +1 @@
|
||||||
Added an environment variable which helps to check if a code is running from within a pytest run
|
Added :envvar:`PYTEST_VERSION` environment variable which is defined at the start of the pytest session and undefined afterwards. It contains the value of ``pytest.__version__``, and among other things can be used to easily check if code is running from within a pytest run.
|
||||||
|
|
|
@ -1096,7 +1096,7 @@ def test_outcome_exception_bad_msg() -> None:
|
||||||
assert str(excinfo.value) == expected
|
assert str(excinfo.value) == expected
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_version(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
|
def test_pytest_version_env_var(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
|
||||||
pytester.makepyfile(
|
pytester.makepyfile(
|
||||||
"""
|
"""
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1108,6 +1108,5 @@ def test_pytest_version(pytester: Pytester, monkeypatch: MonkeyPatch) -> None:
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
result = pytester.runpytest_inprocess()
|
result = pytester.runpytest_inprocess()
|
||||||
# assert result.ret == 0
|
|
||||||
assert result.ret == ExitCode.OK
|
assert result.ret == ExitCode.OK
|
||||||
assert "PYTEST_VERSION" not in os.environ
|
assert "PYTEST_VERSION" not in os.environ
|
||||||
|
|
Loading…
Reference in New Issue