2020-07-27 08:56:06 +08:00
|
|
|
import os.path
|
|
|
|
import shutil
|
2018-05-23 22:48:46 +08:00
|
|
|
|
2020-07-27 08:56:06 +08:00
|
|
|
failure_demo = os.path.join(os.path.dirname(__file__), "failure_demo.py")
|
2018-06-26 21:35:27 +08:00
|
|
|
pytest_plugins = ("pytester",)
|
2018-05-23 22:48:46 +08:00
|
|
|
|
2008-09-02 20:24:15 +08:00
|
|
|
|
2021-03-14 03:22:54 +08:00
|
|
|
def test_failure_demo_fails_properly(pytester):
|
|
|
|
target = pytester.path.joinpath(os.path.basename(failure_demo))
|
2020-07-27 08:56:06 +08:00
|
|
|
shutil.copy(failure_demo, target)
|
2021-03-14 03:22:54 +08:00
|
|
|
result = pytester.runpytest(target, syspathinsert=True)
|
2018-08-03 22:23:50 +08:00
|
|
|
result.stdout.fnmatch_lines(["*44 failed*"])
|
2010-01-18 20:16:58 +08:00
|
|
|
assert result.ret != 0
|