← Back to team overview

yellow team mailing list archive

[Merge] lp:~yellow/testrepository/integrate_worker_tagging into lp:testrepository

 

Gary Poster has proposed merging lp:~yellow/testrepository/integrate_worker_tagging into lp:testrepository.

Requested reviews:
  testrepository committers (testrepository)

For more details, see:
https://code.launchpad.net/~yellow/testrepository/integrate_worker_tagging/+merge/102165

This branch depends on the testtools changes in https://code.launchpad.net/~jml/testtools/wrap-result-in-concurrent-suite/+merge/101902 and https://code.launchpad.net/~jml/testtools/tagger/+merge/101904, which have yet to be merged.  It  may also depend on https://code.launchpad.net/~jml/testtools/tsfr-fixup/+merge/101898 .  This is simply benji's integration of the tools jml provided to give the desired behavior.

This also has no tests atm.

We're submitting it now primarily to verify that this is an acceptable approach.  If so, we'll add some tests, but the code is essentially an integration of well-tested components.  The tests should be simple and basic.

Thanks
-- 
https://code.launchpad.net/~yellow/testrepository/integrate_worker_tagging/+merge/102165
Your team Launchpad Yellow Squad is subscribed to branch lp:~yellow/testrepository/integrate_worker_tagging.
=== modified file 'testrepository/commands/load.py'
--- testrepository/commands/load.py	2011-11-03 15:09:02 +0000
+++ testrepository/commands/load.py	2012-04-16 18:58:20 +0000
@@ -17,13 +17,22 @@
 import optparse
 
 import subunit
-from testtools import ConcurrentTestSuite, MultiTestResult
+from testtools import ConcurrentTestSuite, MultiTestResult, Tagger
 
 from testrepository.commands import Command
 from testrepository.repository import RepositoryNotFound
 from testrepository.results import TestResultFilter
 
 
+class TaggingConcurrentTestSuite(ConcurrentTestSuite):
+
+    def _wrap_result(self, result, thread_number):
+        worker_id = 'worker-%s' % thread_number
+        tags_to_add = set([worker_id])
+        tags_to_remove = set()
+        return Tagger(result, tags_to_add, tags_to_remove)
+
+
 class load(Command):
     """Load a subunit stream into a repository.
 
@@ -62,7 +71,7 @@
             streams = list(suite)[0]
             for stream in streams():
                 yield subunit.ProtocolTestCase(stream)
-        case = ConcurrentTestSuite(cases, make_tests)
+        case = TaggingConcurrentTestSuite(cases, make_tests)
         inserter = repo.get_inserter(partial=self.ui.options.partial)
         try:
             previous_run = repo.get_latest_run()


Follow ups