Rev 4659: Detangle test listing: its more part of the ui layer not the execute-this-test-layer. in http://bazaar.launchpad.net/~lifeless/bzr/test-speed

Robert Collins robertc at robertcollins.net
Thu Aug 27 00:30:51 BST 2009


At http://bazaar.launchpad.net/~lifeless/bzr/test-speed

------------------------------------------------------------
revno: 4659
revision-id: robertc at robertcollins.net-20090826233048-4yerdwqhvi2dqzi9
parent: robertc at robertcollins.net-20090826232528-sld5o6xa1afm08y8
committer: Robert Collins <robertc at robertcollins.net>
branch nick: test-speed
timestamp: Thu 2009-08-27 09:30:48 +1000
message:
  Detangle test listing: its more part of the ui layer not the execute-this-test-layer.
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-08-26 23:25:28 +0000
+++ b/bzrlib/tests/__init__.py	2009-08-26 23:30:48 +0000
@@ -608,7 +608,6 @@
                  descriptions=0,
                  verbosity=1,
                  bench_history=None,
-                 list_only=False,
                  strict=False,
                  result_decorators=None,
                  ):
@@ -623,20 +622,11 @@
         self.descriptions = descriptions
         self.verbosity = verbosity
         self._bench_history = bench_history
-        self.list_only = list_only
         self._strict = strict
         self._result_decorators = result_decorators or []
 
     def run(self, test):
         "Run the given test case or test suite."
-        if self.list_only:
-            if self.verbosity >= 2:
-                self.stream.writeln("Listing tests only ...\n")
-            run = 0
-            for t in iter_suite_tests(test):
-                self.stream.writeln("%s" % (t.id()))
-                run += 1
-            return None
         if self.verbosity == 1:
             result_class = TextTestResult
         elif self.verbosity >= 2:
@@ -2804,7 +2794,6 @@
                             descriptions=0,
                             verbosity=verbosity,
                             bench_history=bench_history,
-                            list_only=list_only,
                             strict=strict,
                             result_decorators=result_decorators,
                             )
@@ -2827,9 +2816,15 @@
         decorators.append(CountingDecorator)
     for decorator in decorators:
         suite = decorator(suite)
-    result = runner.run(suite)
     if list_only:
+        # Done after test suite decoration to allow randomisation etc
+        # to take effect, though that is of marginal benefit.
+        if verbosity >= 2:
+            stream.write("Listing tests only ...\n")
+        for t in iter_suite_tests(suite):
+            stream.write("%s\n" % (t.id()))
         return True
+    result = runner.run(suite)
     if strict:
         return result.wasStrictlySuccessful()
     else:




More information about the bazaar-commits mailing list