[Zope3-checkins] SVN: zope.testing/branches/ctheune-cleanup/src/zope/testing/testrunner/runner.py moving more configuration code out

Christian Theune ct at gocept.com
Sat May 3 14:03:29 EDT 2008


Log message for revision 86260:
  moving more configuration code out
  

Changed:
  U   zope.testing/branches/ctheune-cleanup/src/zope/testing/testrunner/runner.py

-=-
Modified: zope.testing/branches/ctheune-cleanup/src/zope/testing/testrunner/runner.py
===================================================================
--- zope.testing/branches/ctheune-cleanup/src/zope/testing/testrunner/runner.py	2008-05-03 17:57:44 UTC (rev 86259)
+++ zope.testing/branches/ctheune-cleanup/src/zope/testing/testrunner/runner.py	2008-05-03 18:03:29 UTC (rev 86260)
@@ -79,42 +79,17 @@
 
     def run(self):
         self.configure()
-        self.setup_features()
-        self.shutdown_features()
 
-        # Set the default logging policy.
-        # XXX There are no tests for this logging behavior.
-        # It's not at all clear that the test runner should be doing this.
-        configure_logging()
+        if self.options.fail:
+            return True
 
+        self.setup_features()
         # Control reporting flags during run
         old_reporting_flags = doctest.set_unittest_reportflags(0)
 
-        # Check to see if we are being run as a subprocess. If we are,
-        # then use the resume-layer and defaults passed in.
-        if len(self.args) > 1 and self.args[1] == '--resume-layer':
-            self.args.pop(1)
-            resume_layer = self.args.pop(1)
-            resume_number = int(self.args.pop(1))
-            self.defaults = []
-            while len(self.args) > 1 and self.args[1] == '--default':
-                self.args.pop(1)
-                self.defaults.append(self.args.pop(1))
-
-            sys.stdin = FakeInputContinueGenerator()
-        else:
-            resume_layer = resume_number = None
-
-        options = get_options(self.args, self.defaults)
-        if options.fail:
-            return True
-
+        options = self.options
         output = options.output
 
-        options.testrunner_defaults = self.defaults
-        options.resume_layer = resume_layer
-        options.resume_number = resume_number
-
         # Make sure we start with real pdb.set_trace.  This is needed
         # to make tests of the test runner work properly. :)
         pdb.set_trace = real_pdb_set_trace
@@ -167,6 +142,8 @@
                 # attempt to unlink a still-open file.
                 os.close(oshandle)
 
+        self.shutdown_features()
+
         if options.profile and not options.resume_layer:
             stats = profiler.loadStats(prof_glob)
             stats.sort_stats('cumulative', 'calls')
@@ -188,9 +165,36 @@
         if self.args is None:
             self.args = sys.argv[:]
 
+        # Check to see if we are being run as a subprocess. If we are,
+        # then use the resume-layer and defaults passed in.
+        if len(self.args) > 1 and self.args[1] == '--resume-layer':
+            self.args.pop(1)
+            resume_layer = self.args.pop(1)
+            resume_number = int(self.args.pop(1))
+            self.defaults = []
+            while len(self.args) > 1 and self.args[1] == '--default':
+                self.args.pop(1)
+                self.defaults.append(self.args.pop(1))
+
+            sys.stdin = FakeInputContinueGenerator()
+        else:
+            resume_layer = resume_number = None
+
+        options = get_options(self.args, self.defaults)
+
+        options.testrunner_defaults = self.defaults
+        options.resume_layer = resume_layer
+        options.resume_number = resume_number
+
+        self.options = options
+
     def setup_features(self):
-        pass
+        # Set the default logging policy.
+        # XXX There are no tests for this logging behavior.
+        # It's not at all clear that the test runner should be doing this.
+        configure_logging()
 
+
     def find_tests(self):
         pass
 



More information about the Zope3-Checkins mailing list