turn this into a black-box test

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-01-18 13:16:58 +01:00
parent 55fcc5a219
commit 1e76202b65
1 changed files with 8 additions and 7 deletions

View File

@ -5,10 +5,11 @@ failure_demo = py.path.local(__file__).dirpath('failure_demo.py')
pytest_plugins = "pytest_pytester" pytest_plugins = "pytest_pytester"
def test_failure_demo_fails_properly(testdir): def test_failure_demo_fails_properly(testdir):
reprec = testdir.inline_run(failure_demo) target = testdir.tmpdir.join(failure_demo.basename)
passed, skipped, failed = reprec.countoutcomes() failure_demo.copy(target)
assert passed == 0 failure_demo.copy(testdir.tmpdir.join(failure_demo.basename))
assert failed == 20, failed result = testdir.runpytest(target)
colreports = reprec.getreports("pytest_collectreport") result.stdout.fnmatch_lines([
failed = len([x.failed for x in colreports]) "*20 failed*"
assert failed == 3 ])
assert result.ret != 0