[py-svn] r56689 - in py/branch/event/py/test2: . rep testing
hpk at codespeak.net
hpk at codespeak.net
Sun Jul 20 17:56:29 CEST 2008
Author: hpk
Date: Sun Jul 20 17:56:28 2008
New Revision: 56689
Modified:
py/branch/event/py/test2/rep/terminal.py
py/branch/event/py/test2/runner.py
py/branch/event/py/test2/testing/test_runner.py
Log:
fix skipping at setup time + test
Modified: py/branch/event/py/test2/rep/terminal.py
==============================================================================
--- py/branch/event/py/test2/rep/terminal.py (original)
+++ py/branch/event/py/test2/rep/terminal.py Sun Jul 20 17:56:28 2008
@@ -50,5 +50,7 @@
return "."
elif ev.skipped:
return "s"
+ elif ev.setupfailed:
+ return "f"
elif ev.failed:
return "F"
Modified: py/branch/event/py/test2/runner.py
==============================================================================
--- py/branch/event/py/test2/runner.py (original)
+++ py/branch/event/py/test2/runner.py Sun Jul 20 17:56:28 2008
@@ -38,10 +38,10 @@
# make report
trail = item._get_collector_trail()
repr_run = None
- if excinfo is not None and outcome == "passed":
+ if excinfo is not None:
if excinfo.errisinstance((Skipped, Skipped2)):
outcome = "skipped"
- else:
+ elif outcome == "passed":
outcome = "failed"
runnerinfo = RunnerInfo(excinfo, outerr)
repr_path = item.repr_path()
Modified: py/branch/event/py/test2/testing/test_runner.py
==============================================================================
--- py/branch/event/py/test2/testing/test_runner.py (original)
+++ py/branch/event/py/test2/testing/test_runner.py Sun Jul 20 17:56:28 2008
@@ -52,6 +52,9 @@
py.test2.skip("hello")
""")
assert testrep.skipped
+ assert not testrep.passed
+ assert not testrep.failed
+ assert not testrep.setupfailed
def test_run_capture_stdout(self):
testrep = self.runtestfunc("""
@@ -121,6 +124,19 @@
i = s.find("def ")
assert s[i+4:].startswith("setup_module")
+ def test_setup_skip(self):
+ testrep = self.runtestfunc("""
+ import py
+ def setup_module(mod):
+ py.test.skip("setupmoduleskip")
+ def testfunc():
+ pass
+ """)
+ assert testrep.skipped
+ assert not testrep.passed
+ assert not testrep.setupfailed
+ assert not testrep.failed
+
def test_setupfailure_always_python_traceback(self):
item = self.makeitem("""
def setup_module(mod):
@@ -157,20 +173,6 @@
# display python Tracebacks starting from the
# failing teardown function
- def test_setupfailure_on_deferred_teardown(self):
- py.test.skip("implement setupfailures, extend help machinery")
- testrep = self.runtestfunc("""
- class TestA:
- def testfunc(self):
- pass
- def teardown_class(cls):
- raise ValueError(12)
- def setup_function(self, method):
- raise ValueError(11)
- def testfunc():
- pass
- """, "TestA.testfunc", "testfunc")
-
class TestForkRunner(TestRunner):
def setup_class(cls):
if not hasattr(py.std.os, 'fork'):
More information about the pytest-commit
mailing list