summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS9
-rw-r--r--testrepository/commands/load.py7
2 files changed, 13 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index e7f1b1f..a990724 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,15 @@ testrepository release notes
NEXT (In development)
+++++++++++++++++++++
+IMPROVEMENTS
+-------
+
+* Tests will be reliably tagged with worker-%d. The previous tagging logic
+ had an implicit race - the tag id was looked up via a closure which gets
+ the state of the pos variable at the position the overall loop has advanced
+ too, not the position when the closure was created.
+ (Robert Collins, #1316858)
+
0.0.19
++++++
diff --git a/testrepository/commands/load.py b/testrepository/commands/load.py
index 0ca4688..1d52965 100644
--- a/testrepository/commands/load.py
+++ b/testrepository/commands/load.py
@@ -100,6 +100,8 @@ class load(Command):
streams = map(opener, self.ui.arguments['streams'])
else:
streams = self.ui.iter_streams('subunit')
+ mktagger = lambda pos, result:testtools.StreamTagger(
+ [result], add=['worker-%d' % pos])
def make_tests():
for pos, stream in enumerate(streams):
if v2_avail:
@@ -121,9 +123,8 @@ class load(Command):
case = testtools.DecorateTestCaseResult(case, wrap_result,
methodcaller('startTestRun'),
methodcaller('stopTestRun'))
- case = testtools.DecorateTestCaseResult(case,
- lambda result:testtools.StreamTagger(
- [result], add=['worker-%d' % pos]))
+ decorate = partial(mktagger, pos)
+ case = testtools.DecorateTestCaseResult(case, decorate)
yield (case, str(pos))
case = testtools.ConcurrentStreamTestSuite(make_tests)
# One unmodified copy of the stream to repository storage