[py-svn] py-trunk commit 302fcb17fba8: turn this into a black-box test

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Jan 18 13:17:09 CET 2010


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1263817018 -3600
# Node ID 302fcb17fba808d3545e19544128736e88d11863
# Parent 576f202bf9075ec7c7d4ab7951ebd3bdf558dfe0
turn this into a black-box test

--- a/doc/example/assertion/test_failures.py
+++ b/doc/example/assertion/test_failures.py
@@ -5,10 +5,11 @@ failure_demo = py.path.local(__file__).d
 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



More information about the pytest-commit mailing list