test_ok1/doc/en/example/assertion/test_failures.py

14 lines
444 B
Python
Raw Normal View History

import py
2018-05-23 22:48:46 +08:00
failure_demo = py.path.local(__file__).dirpath("failure_demo.py")
pytest_plugins = ("pytester",)
2018-05-23 22:48:46 +08:00
def test_failure_demo_fails_properly(testdir):
target = testdir.tmpdir.join(failure_demo.basename)
failure_demo.copy(target)
failure_demo.copy(testdir.tmpdir.join(failure_demo.basename))
result = testdir.runpytest(target, syspathinsert=True)
2018-08-03 22:23:50 +08:00
result.stdout.fnmatch_lines(["*44 failed*"])
assert result.ret != 0