Merge lp:~jml/python-fixtures/busted-combine-details into lp:~python-fixtures/python-fixtures/trunk

Proposed by Jonathan Lange
Status: Merged
Merged at revision: 46
Proposed branch: lp:~jml/python-fixtures/busted-combine-details
Merge into: lp:~python-fixtures/python-fixtures/trunk
Diff against target: 38 lines (+16/-1)
2 files modified
lib/fixtures/fixture.py (+4/-1)
lib/fixtures/tests/test_fixture.py (+12/-0)
To merge this branch: bzr merge lp:~jml/python-fixtures/busted-combine-details
Reviewer Review Type Date Requested Status
python-fixtures committers Pending
Review via email: mp+83427@code.launchpad.net

Description of the change

Fixes an obvious (i.e. pyflakes caught it) error in fixtures/fixture.py where combine_details would explode given duplicate names of details. I've added a test to catch it.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

Thanks for this. It was missing a NEWS entry.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/fixtures/fixture.py'
2--- lib/fixtures/fixture.py 2011-07-26 23:07:48 +0000
3+++ lib/fixtures/fixture.py 2011-11-25 18:00:48 +0000
4@@ -23,7 +23,10 @@
5 import itertools
6 import sys
7
8-from testtools.compat import reraise
9+from testtools.compat import (
10+ advance_iterator,
11+ reraise,
12+ )
13 from testtools.helpers import try_import
14
15 class MultipleExceptions(Exception):
16
17=== modified file 'lib/fixtures/tests/test_fixture.py'
18--- lib/fixtures/tests/test_fixture.py 2011-06-23 07:56:42 +0000
19+++ lib/fixtures/tests/test_fixture.py 2011-11-25 18:00:48 +0000
20@@ -163,6 +163,18 @@
21 child.addDetail('foo', 'content')
22 self.assertEqual({}, parent.getDetails())
23
24+ def test_duplicate_details_are_disambiguated(self):
25+ parent = fixtures.Fixture()
26+ with parent:
27+ parent.addDetail('foo', 'parent-content')
28+ child = fixtures.Fixture()
29+ parent.useFixture(child)
30+ # Note that we add the detail *after* using the fixture: the parent
31+ # has to query just-in-time.
32+ child.addDetail('foo', 'child-content')
33+ self.assertEqual({'foo': 'parent-content',
34+ 'foo-1': 'child-content',}, parent.getDetails())
35+
36 def test_addDetail(self):
37 fixture = fixtures.Fixture()
38 with fixture:

Subscribers

People subscribed via source and target branches