summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-07-29 11:46:34 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2009-07-29 11:46:34 +0200
commitdaca0d1543e91bec9cdcef0f68e28f70271c1779 (patch)
treec4bf350a35c788c6e051b7544302838d54f3f04f /pytest.py
parent71f80b37c405e672f25b25beec42c09f7d2bd13e (diff)
downloadlogilab-common-daca0d1543e91bec9cdcef0f68e28f70271c1779.tar.gz
[pytest] fix batchmode exeution, don't capture streams
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py17
1 files changed, 4 insertions, 13 deletions
diff --git a/pytest.py b/pytest.py
index db43bb8..d31410f 100644
--- a/pytest.py
+++ b/pytest.py
@@ -413,15 +413,10 @@ succeeded test file :", osp.join(os.getcwd(),testlib.FILE_RESTART)
succeeded test file :", osp.join(os.getcwd(),testlib.FILE_RESTART)
raise e
modname = osp.basename(filename)[:-3]
- if batchmode:
- from cStringIO import StringIO
- outstream = StringIO()
- else:
- outstream = sys.stderr
try:
- print >> outstream, (' %s ' % osp.basename(filename)).center(70, '=')
+ print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70, '=')
except TypeError: # < py 2.4 bw compat
- print >> outstream, (' %s ' % osp.basename(filename)).center(70)
+ print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70)
try:
tstart, cstart = time(), clock()
try:
@@ -438,17 +433,13 @@ succeeded test file :", osp.join(os.getcwd(),testlib.FILE_RESTART)
return None
except Exception:
self.report.failed_to_test_module(filename)
- print >> outstream, 'unhandled exception occured while testing', modname
+ print >> sys.stderr, 'unhandled exception occured while testing', modname
import traceback
- traceback.print_exc(file=outstream)
- if batchmode:
- print >> sys.stderr, outstream.getvalue()
+ traceback.print_exc(file=sys.stderr)
return None
tend, cend = time(), clock()
ttime, ctime = (tend - tstart), (cend - cstart)
- if testprog.result.testsRun and batchmode:
- print >> sys.stderr, outstream.getvalue()
self.report.feed(filename, testprog.result, ttime, ctime)
return testprog
finally: