summaryrefslogtreecommitdiff
path: root/pytest.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-11 15:12:17 +0200
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2008-07-11 15:12:17 +0200
commit958957f4e0743e0c071289241dcd29bc1fa8fd12 (patch)
tree616a3c7d8baf3300f827fb2d34c4a238afe4ea48 /pytest.py
parentb6b040771094ffc183090a68ee23e0ad6c8ec2a5 (diff)
downloadlogilab-common-958957f4e0743e0c071289241dcd29bc1fa8fd12.tar.gz
make pytest less verbose when running recursively with a specific pattern
Diffstat (limited to 'pytest.py')
-rw-r--r--pytest.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pytest.py b/pytest.py
index b714273..f59e4f7 100644
--- a/pytest.py
+++ b/pytest.py
@@ -338,17 +338,24 @@ class PyTester(object):
if dirname:
os.chdir(dirname)
modname = osp.basename(filename)[:-3]
+ if batchmode:
+ from cStringIO import StringIO
+ outstream = StringIO()
+ else:
+ outstream = sys.stderr
try:
- print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70, '=')
+ print >> outstream, (' %s ' % osp.basename(filename)).center(70, '=')
except TypeError: # < py 2.4 bw compat
- print >> sys.stderr, (' %s ' % osp.basename(filename)).center(70)
+ print >> outstream, (' %s ' % osp.basename(filename)).center(70)
try:
try:
tstart, cstart = time(), clock()
testprog = testlib.unittest_main(modname, batchmode=batchmode, cvg=self.cvg,
- options=self.options)
+ options=self.options, outstream=outstream)
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
except (KeyboardInterrupt, SystemExit):