[py-svn] r8228 - in py/dist/py: documentation/example/pytest test test/report/text
hpk at codespeak.net
hpk at codespeak.net
Wed Jan 12 16:08:55 CET 2005
Author: hpk
Date: Wed Jan 12 16:08:55 2005
New Revision: 8228
Modified:
py/dist/py/documentation/example/pytest/failure_demo.py
py/dist/py/test/drive.py
py/dist/py/test/report/text/summary.py
Log:
experimental: don't let SystemExits from executing tests
propagate. add an example to the failure_demo.py series.
Basically we only let KeyboardErrors through now.
Modified: py/dist/py/documentation/example/pytest/failure_demo.py
==============================================================================
--- py/dist/py/documentation/example/pytest/failure_demo.py (original)
+++ py/dist/py/documentation/example/pytest/failure_demo.py Wed Jan 12 16:08:55 2005
@@ -109,3 +109,6 @@
def globf(x):
return x+1
+
+def test_systemexit_doesnt_leave():
+ raise SystemExit
Modified: py/dist/py/test/drive.py
==============================================================================
--- py/dist/py/test/drive.py (original)
+++ py/dist/py/test/drive.py Wed Jan 12 16:08:55 2005
@@ -62,15 +62,15 @@
elif isinstance(obj, py.test.collect.Collector.Error):
try:
self.reporter.report_collect_error(obj)
- except (KeyboardInterrupt, SystemExit):
+ except (KeyboardInterrupt, self.Exit):
raise
except:
print "*" * 80
- print "Reporter Error"
+ print "internal Reporter Error"
print "*" * 80
import traceback
traceback.print_exc()
- raise SystemExit, 1
+ raise self.Exit
if self.option.exitfirstproblem:
raise self.Exit()
else:
@@ -93,9 +93,9 @@
except item.Outcome, res:
if not hasattr(res, 'excinfo'):
res.excinfo = py.code.ExceptionInfo()
- except (KeyboardInterrupt, SystemExit):
+ except (KeyboardInterrupt, self.Exit):
raise
- except:
+ except:
res = item.Failed(excinfo=py.code.ExceptionInfo())
else:
res = item.Passed()
Modified: py/dist/py/test/report/text/summary.py
==============================================================================
--- py/dist/py/test/report/text/summary.py (original)
+++ py/dist/py/test/report/text/summary.py Wed Jan 12 16:08:55 2005
@@ -88,7 +88,8 @@
def repr_failure_result(self, res):
exprinfo = None
- if not self.option.nomagic:
+ if not self.option.nomagic and \
+ not isinstance(res.excinfo.value, SystemExit):
try:
exprinfo = res.excinfo.reinterpret() # very detailed info
except KeyboardInterrupt:
More information about the pytest-commit
mailing list