Add test for calling pytest.exit with statuscode
It checks that a SystemError was raised and the SystemError code is the same as the returncode argument.
This commit is contained in:
parent
d7be039f1b
commit
ce55dcf64c
|
@ -570,6 +570,15 @@ def test_pytest_exit_msg(testdir):
|
|||
result.stderr.fnmatch_lines(["Exit: oh noes"])
|
||||
|
||||
|
||||
def test_pytest_exit_returncode():
|
||||
try:
|
||||
pytest.exit("hello", returncode=2)
|
||||
except SystemExit as exc:
|
||||
excinfo = _pytest._code.ExceptionInfo()
|
||||
assert excinfo.errisinstance(SystemExit)
|
||||
assert excinfo.value.code == 2
|
||||
|
||||
|
||||
def test_pytest_fail_notrace_runtest(testdir):
|
||||
"""Test pytest.fail(..., pytrace=False) does not show tracebacks during test run."""
|
||||
testdir.makepyfile(
|
||||
|
|
Loading…
Reference in New Issue