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

14 lines
427 B
Python

import os.path
import shutil
failure_demo = os.path.join(os.path.dirname(__file__), "failure_demo.py")
pytest_plugins = ("pytester",)
def test_failure_demo_fails_properly(pytester):
target = pytester.path.joinpath(os.path.basename(failure_demo))
shutil.copy(failure_demo, target)
result = pytester.runpytest(target, syspathinsert=True)
result.stdout.fnmatch_lines(["*44 failed*"])
assert result.ret != 0