[py-svn] r7729 - in py/dist/py/test: . report/text

hpk at codespeak.net hpk at codespeak.net
Thu Dec 2 22:19:46 CET 2004


Author: hpk
Date: Thu Dec  2 22:19:45 2004
New Revision: 7729

Modified:
   py/dist/py/test/config.py
   py/dist/py/test/defaultconfig.py
   py/dist/py/test/report/text/reporter.py
   py/dist/py/test/run.py
Log:
reenabled --pdb support and guard against using 
both --session and --pdb at the same time. 

--session runs the tests in a separate child 
process and allowing --pdb in this context 
requires a bit of terminal hacking, at least on Unix. 
I hope that Armin can help out at some point as he 
has been doing some crazy terminal stuff lately ... 



Modified: py/dist/py/test/config.py
==============================================================================
--- py/dist/py/test/config.py	(original)
+++ py/dist/py/test/config.py	Thu Dec  2 22:19:45 2004
@@ -74,6 +74,8 @@
         
         # parse cmdline args  
         cmdlineoption, remaining = parser.parse_args(args, self.option) 
+
+        self.checkoptions() 
         # override previously computed defaults 
         #for name in cmdlineoption.__dict__:
         #    if not name.startswith('_'):
@@ -82,6 +84,10 @@
         return remaining 
 
 
+    def checkoptions(self): 
+        if self.option.session and self.option.usepdb: 
+            raise ValueError, "--session together with --pdb not supported yet." 
+
 config = Config()
 
 # helpers 

Modified: py/dist/py/test/defaultconfig.py
==============================================================================
--- py/dist/py/test/defaultconfig.py	(original)
+++ py/dist/py/test/defaultconfig.py	Thu Dec  2 22:19:45 2004
@@ -26,9 +26,9 @@
         Option('', '--nomagic', 
                action="store_true", dest="nomagic", default=False, 
                help="don't invoke magic to e.g. beautify failing/error statements."),
-        #Option('', '--pdb',
-        #       action="store_true", dest="usepdb", default=False,
-        #       help="Start pdb (the Python debugger) on errors."),
+        Option('', '--pdb',
+               action="store_true", dest="usepdb", default=False,
+               help="Start pdb (the Python debugger) on errors."),
         Option('', '--collectonly', 
                action="store_true", dest="collectonly", default=False,
                help="only collect tests, don't execute them. "),

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	Thu Dec  2 22:19:45 2004
@@ -142,15 +142,15 @@
             self.out.rewrite("%.3f %-2s %-20s %s%s" % (
                 elapsed, resultstring, location, str(item.extpy.modpath), writeinfo
                 ))
-        #if self.option.usepdb:
-        #    if (issubclass(restype, Collector.Error) or
-        #        issubclass(restype, Item.Failed)):
-        #        import pdb
-        #        self.out.rewrite(
-        #            '\n%s: %s\n'
-        #            % (result.excinfo[1].__class__.__name__,
-        #               result.excinfo[1]))
-        #        pdb.post_mortem(result.excinfo[2])
+        if self.option.usepdb:
+            if (issubclass(restype, Collector.Error) or
+                issubclass(restype, Item.Failed)):
+                import pdb
+                self.out.rewrite(
+                    '\n%s: %s\n'
+                    % (result.excinfo[1].__class__.__name__,
+                       result.excinfo[1]))
+                pdb.post_mortem(result.excinfo[2])
 
     def report_collect_error(self, error):
         restype, c = self.processresult(error) 

Modified: py/dist/py/test/run.py
==============================================================================
--- py/dist/py/test/run.py	(original)
+++ py/dist/py/test/run.py	Thu Dec  2 22:19:45 2004
@@ -182,5 +182,5 @@
             failures = master(args, filenames) 
             print "#" * 60
             print "# session mode: %d failures remaining" % len(failures)
-            print "#    checking py files below %s" % rootdir
+            print "#    watching py files below %s" % rootdir
             print "#                           ", "^" * l



More information about the pytest-commit mailing list