[py-svn] r8377 - py/dist/py/test/report/text

hpk at codespeak.net hpk at codespeak.net
Tue Jan 18 13:28:10 CET 2005


Author: hpk
Date: Tue Jan 18 13:28:09 2005
New Revision: 8377

Modified:
   py/dist/py/test/report/text/reporter.py
Log:
make the default reporter a bit nicer (IMO, feel free
to suggest different default behaviour) 



Modified: py/dist/py/test/report/text/reporter.py
==============================================================================
--- py/dist/py/test/report/text/reporter.py	(original)
+++ py/dist/py/test/report/text/reporter.py	Tue Jan 18 13:28:09 2005
@@ -85,31 +85,29 @@
 
     def open_Module(self, collector):
         verbose = self.option.verbose
-        if verbose < 1:
-            return
         numunits = len(list(collector.iterunits()))
         if numunits > 0:
-            #if verbose < 2:
-            #    self.out.write('%s[%d]' % (collector.extpy,
-            #                           numunits))
-            #else:
-            #self.out.line("collector.fspy.modpath)
-            return self.out.line
+            fspath = collector.extpy.root 
+            if verbose == 0: 
+                parts = fspath.parts() 
+                basename = parts.pop().basename
+                while parts and parts[-1].basename in ('testing', 'test'): 
+                    parts.pop() 
+                base = parts[-1].basename
+                if len(base) < 13: 
+                    base = base + "_" * (13-len(base))
+                abbrev_fn = base + "_" + basename 
+                self.out.write('%s[%d] ' % (abbrev_fn, numunits))
+                return self.out.line
+            elif verbose > 0: 
+                #curdir = py.path.local()
+                #if fspath.check(local=True, relto=curdir): 
+                #    fspath = fspath.relto(curdir) 
+                self.out.line()
+                self.out.line("+ testmodule: %s" % fspath) 
 
     def open_Directory(self, collector):
-        if self.option.verbose < 1:
-            return
-        l = []
-        for x in collector:
-            l.append(x)
-            break
-        if l:
-            self.out.line('%-13s %s' %('+ directory start ', collector.fspath))
-            if self.option.verbose >=1:
-                def close_directory():
-                    self.out.line('%-13s %s' %('- directory finish', collector.fspath))
-                    self.out.line()
-                return close_directory
+        return 
 
     def startitem(self, item):
         if self.option.collectonly:



More information about the pytest-commit mailing list