From 1e76202b656e8824870b93caebdd066966c0951f Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 18 Jan 2010 13:16:58 +0100 Subject: [PATCH] turn this into a black-box test --HG-- branch : trunk --- doc/example/assertion/test_failures.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/example/assertion/test_failures.py b/doc/example/assertion/test_failures.py index 52983e26e..77bb3797c 100644 --- a/doc/example/assertion/test_failures.py +++ b/doc/example/assertion/test_failures.py @@ -5,10 +5,11 @@ failure_demo = py.path.local(__file__).dirpath('failure_demo.py') pytest_plugins = "pytest_pytester" def test_failure_demo_fails_properly(testdir): - reprec = testdir.inline_run(failure_demo) - passed, skipped, failed = reprec.countoutcomes() - assert passed == 0 - assert failed == 20, failed - colreports = reprec.getreports("pytest_collectreport") - failed = len([x.failed for x in colreports]) - assert failed == 3 + target = testdir.tmpdir.join(failure_demo.basename) + failure_demo.copy(target) + failure_demo.copy(testdir.tmpdir.join(failure_demo.basename)) + result = testdir.runpytest(target) + result.stdout.fnmatch_lines([ + "*20 failed*" + ]) + assert result.ret != 0