Rev 4235: (vila) Fix selftest --parallel result handling in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Apr 2 08:21:42 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4235
revision-id: pqm at pqm.ubuntu.com-20090402072138-cqrfqyky0dnrqnbi
parent: pqm at pqm.ubuntu.com-20090402061945-oh2qwvhwlpbeyyx4
parent: v.ladeuil+lp at free.fr-20090402063347-i4e7m5yaabgz052f
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-04-02 08:21:38 +0100
message:
  (vila) Fix selftest --parallel result handling
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4234.1.1
    revision-id: v.ladeuil+lp at free.fr-20090402063347-i4e7m5yaabgz052f
    parent: pqm at pqm.ubuntu.com-20090402061945-oh2qwvhwlpbeyyx4
    parent: v.ladeuil+lp at free.fr-20090402062902-xenjze5i1fzv8xu1
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: integration
    timestamp: Thu 2009-04-02 08:33:47 +0200
    message:
      (vila) Fix selftest --parallel result handling
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4229.3.2
    revision-id: v.ladeuil+lp at free.fr-20090402062902-xenjze5i1fzv8xu1
    parent: v.ladeuil+lp at free.fr-20090401104418-tev44lw48rzxcfw0
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: parallel-selftest
    timestamp: Thu 2009-04-02 08:29:02 +0200
    message:
      Fixed as per Robert's review.
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
    ------------------------------------------------------------
    revno: 4229.3.1
    revision-id: v.ladeuil+lp at free.fr-20090401104418-tev44lw48rzxcfw0
    parent: pqm at pqm.ubuntu.com-20090401063434-motksin95y4undi6
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: parallel-selftest
    timestamp: Wed 2009-04-01 12:44:18 +0200
    message:
      Fix selftest --parallel for ConcurrentTestSuite uses.
      
      * bzrlib/tests/__init__.py:
      (TextTestRunner.run): The test type matters here, not the
      result (which is set just above).
    modified:
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-04-02 04:12:11 +0000
+++ b/bzrlib/tests/__init__.py	2009-04-02 06:33:47 +0000
@@ -545,11 +545,12 @@
             actionTaken = "Listed"
         else:
             try:
-                from testtools import ThreadsafeForwardingResult
+                import testtools
             except ImportError:
                 test.run(result)
             else:
-                if type(result) == ThreadsafeForwardingResult:
+                if isinstance(testtools.ConcurrentTestSuite, test):
+                    # We need to catch bzr specific behaviors
                     test.run(BZRTransformingResult(result))
                 else:
                     test.run(result)
@@ -2676,6 +2677,8 @@
 
 # A registry where get() returns a suite decorator.
 parallel_registry = registry.Registry()
+
+
 def fork_decorator(suite):
     concurrency = local_concurrency()
     if concurrency == 1:
@@ -2683,6 +2686,8 @@
     from testtools import ConcurrentTestSuite
     return ConcurrentTestSuite(suite, fork_for_tests)
 parallel_registry.register('fork', fork_decorator)
+
+
 def subprocess_decorator(suite):
     concurrency = local_concurrency()
     if concurrency == 1:
@@ -2874,8 +2879,7 @@
     """Take suite and start up one runner per CPU by forking()
 
     :return: An iterable of TestCase-like objects which can each have
-        run(result) called on them to feed tests to result, and
-        cleanup() called on them to stop them/kill children/end threads.
+        run(result) called on them to feed tests to result.
     """
     concurrency = local_concurrency()
     result = []
@@ -2891,7 +2895,6 @@
                 ProtocolTestCase.run(self, result)
             finally:
                 os.waitpid(self.pid, os.WNOHANG)
-            # print "pid %d finished" % finished_process
 
     test_blocks = partition_tests(suite, concurrency)
     for process_tests in test_blocks:
@@ -2905,10 +2908,10 @@
                 # Leave stderr and stdout open so we can see test noise
                 # Close stdin so that the child goes away if it decides to
                 # read from stdin (otherwise its a roulette to see what
-                # child actually gets keystrokes for pdb etc.
+                # child actually gets keystrokes for pdb etc).
                 sys.stdin.close()
                 sys.stdin = None
-                stream = os.fdopen(c2pwrite, 'wb', 0)
+                stream = os.fdopen(c2pwrite, 'wb', 1)
                 subunit_result = TestProtocolClient(stream)
                 process_suite.run(subunit_result)
             finally:
@@ -2925,8 +2928,7 @@
     """Take suite and start up one runner per CPU using subprocess().
 
     :return: An iterable of TestCase-like objects which can each have
-        run(result) called on them to feed tests to result, and
-        cleanup() called on them to stop them/kill children/end threads.
+        run(result) called on them to feed tests to result.
     """
     concurrency = local_concurrency()
     result = []




More information about the bazaar-commits mailing list