tests: harden test_config_error
This commit is contained in:
parent
401a3cd1bc
commit
a0890f98d8
|
@ -27,8 +27,9 @@ class TestGeneralUsage(object):
|
||||||
def test_config_error(self, testdir):
|
def test_config_error(self, testdir):
|
||||||
testdir.copy_example("conftest_usageerror/conftest.py")
|
testdir.copy_example("conftest_usageerror/conftest.py")
|
||||||
result = testdir.runpytest(testdir.tmpdir)
|
result = testdir.runpytest(testdir.tmpdir)
|
||||||
assert result.ret != 0
|
assert result.ret == EXIT_USAGEERROR
|
||||||
result.stderr.fnmatch_lines(["*ERROR: hello"])
|
result.stderr.fnmatch_lines(["*ERROR: hello"])
|
||||||
|
result.stdout.fnmatch_lines(["*pytest_unconfigure_called"])
|
||||||
|
|
||||||
def test_root_conftest_syntax_error(self, testdir):
|
def test_root_conftest_syntax_error(self, testdir):
|
||||||
testdir.makepyfile(conftest="raise SyntaxError\n")
|
testdir.makepyfile(conftest="raise SyntaxError\n")
|
||||||
|
|
|
@ -2,3 +2,7 @@ def pytest_configure(config):
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
raise pytest.UsageError("hello")
|
raise pytest.UsageError("hello")
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_unconfigure(config):
|
||||||
|
print("pytest_unconfigure_called")
|
||||||
|
|
Loading…
Reference in New Issue