Update returncode exit test to check exitstatus returrned from test session
This commit is contained in:
parent
836c9f82f1
commit
766d2daa06
|
@ -570,13 +570,16 @@ def test_pytest_exit_msg(testdir):
|
||||||
result.stderr.fnmatch_lines(["Exit: oh noes"])
|
result.stderr.fnmatch_lines(["Exit: oh noes"])
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_exit_returncode():
|
def test_pytest_exit_returncode(testdir):
|
||||||
try:
|
testdir.makepyfile(
|
||||||
pytest.exit("hello", returncode=2)
|
"""
|
||||||
except SystemExit as exc:
|
import pytest
|
||||||
excinfo = _pytest._code.ExceptionInfo()
|
def test_foo():
|
||||||
assert excinfo.errisinstance(SystemExit)
|
pytest.exit("some exit msg", 99)
|
||||||
assert excinfo.value.code == 2
|
"""
|
||||||
|
)
|
||||||
|
result = testdir.runpytest()
|
||||||
|
assert result.ret == 99
|
||||||
|
|
||||||
|
|
||||||
def test_pytest_fail_notrace_runtest(testdir):
|
def test_pytest_fail_notrace_runtest(testdir):
|
||||||
|
|
Loading…
Reference in New Issue