2008-08-16 23:26:59 +08:00
|
|
|
|
|
|
|
import py
|
2010-01-17 17:54:36 +08:00
|
|
|
failure_demo = py.path.local(__file__).dirpath('failure_demo.py')
|
2008-09-02 20:24:15 +08:00
|
|
|
|
2009-02-27 18:18:27 +08:00
|
|
|
pytest_plugins = "pytest_pytester"
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-02-27 18:18:27 +08:00
|
|
|
def test_failure_demo_fails_properly(testdir):
|
2009-05-21 20:36:52 +08:00
|
|
|
reprec = testdir.inline_run(failure_demo)
|
|
|
|
passed, skipped, failed = reprec.countoutcomes()
|
2008-08-16 23:26:59 +08:00
|
|
|
assert passed == 0
|
2008-09-02 20:24:15 +08:00
|
|
|
assert failed == 20, failed
|
2009-07-09 01:18:26 +08:00
|
|
|
colreports = reprec.getreports("pytest_collectreport")
|
2008-09-02 20:24:15 +08:00
|
|
|
failed = len([x.failed for x in colreports])
|
2010-01-16 00:50:02 +08:00
|
|
|
assert failed == 3
|