Rev 5431: (spiv) Merge lp:bzr/2.2, including fixes for #625574, #636930, in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Sep 17 10:12:14 BST 2010
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5431 [merge]
revision-id: pqm at pqm.ubuntu.com-20100917091211-1e9h9nf6bsdjr6bd
parent: pqm at pqm.ubuntu.com-20100916070436-jm5qh2fgacocasc4
parent: andrew.bennetts at canonical.com-20100917065959-p7syp0v4z3aep4y8
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2010-09-17 10:12:11 +0100
message:
(spiv) Merge lp:bzr/2.2, including fixes for #625574, #636930,
#254278.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/fetch.py fetch.py-20050818234941-26fea6105696365d
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
bzrlib/tests/per_interrepository/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
bzrlib/tests/test_selftest.py test_selftest.py-20051202044319-c110a115d8c0456a
bzrlib/xml_serializer.py xml.py-20050309040759-57d51586fdec365d
=== modified file 'NEWS'
--- a/NEWS 2010-09-15 10:10:22 +0000
+++ b/NEWS 2010-09-17 06:59:59 +0000
@@ -187,6 +187,11 @@
to a symlink, now returns information about the symlink.
(Martin Pool)
+* Upgrading or fetching from a non-rich-root repository to a rich-root
+ repository (e.g. from pack-0.92 to 2a) no longer fails with
+ ``'Inter1and2Helper' object has no attribute 'source_repo'``.
+ (Andrew Bennetts, #636930)
+
* Wait for the SSH server to actually finish, rather than just waiting for
it to negotiate the key exchange. (John Arbash Meinel, #626876)
@@ -311,6 +316,12 @@
distributed evenly among the parallel test suites, rather than slowing
down just one suite. (Andrew Bennetts)
+* Tracebacks from a parameterized test are no longer reported against every
+ parameterization of that test. This was done by adding a hack to
+ ``bzrlib.tests.clone_test`` so that it no longer causes
+ testtools.TestCase instances to share a details dict.
+ (Andrew Bennetts, #625574)
+
bzr 2.2.1
#########
@@ -350,6 +361,12 @@
later which can mangle bytestrings printed to the console.
(Martin [gz], #631350)
+* Upgrading or fetching from a non-rich-root repository to a rich-root
+ repository (e.g. from pack-0.92 to 2a) no longer fails with
+ ``'Inter1and2Helper' object has no attribute 'source_repo'``. This was
+ a regression from Bazaar 2.1. (Andrew Bennetts, #636930)
+
+
Improvements
************
@@ -366,6 +383,15 @@
* Remove used and broken code path in ``BranchInitHookParams.__repr__``.
(Andrew Bennetts)
+Testing
+*******
+
+* Tracebacks from a parameterized test are no longer reported against every
+ parameterization of that test. This was done by adding a hack to
+ ``bzrlib.tests.clone_test`` so that it no longer causes
+ testtools.TestCase instances to share a details dict.
+ (Andrew Bennetts, #625574)
+
bzr 2.2
#######
@@ -1444,6 +1470,10 @@
* Recursive binding for checkouts is now detected by bzr. A clear error
message is shown to the user. (Parth Malwankar, #405192)
+* Stop ``AttributeError: 'module' object has no attribute 'ElementTree'``
+ being thrown from ``xml_serializer`` on certain cElementTree setups.
+ (Martin [gz], #254278)
+
Improvements
************
=== modified file 'bzrlib/fetch.py'
--- a/bzrlib/fetch.py 2010-09-14 02:54:53 +0000
+++ b/bzrlib/fetch.py 2010-09-17 04:35:23 +0000
@@ -182,6 +182,9 @@
This is for use by fetchers and converters.
"""
+ # This is a class variable so that the test suite can override it.
+ known_graph_threshold = 100
+
def __init__(self, source):
"""Constructor.
@@ -243,10 +246,8 @@
# yet, and are unlikely to in non-rich-root environments anyway.
root_id_order.sort(key=operator.itemgetter(0))
# Create a record stream containing the roots to create.
- if len(revs) > 100:
- # XXX: not covered by tests, should have a flag to always run
- # this. -- mbp 20100129
- graph = self.source_repo.get_known_graph_ancestry(revs)
+ if len(revs) > self.known_graph_threshold:
+ graph = self.source.get_known_graph_ancestry(revs)
new_roots_stream = _new_root_data_stream(
root_id_order, rev_id_to_root_id, parent_map, self.source, graph)
return [('texts', new_roots_stream)]
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2010-09-16 03:17:53 +0000
+++ b/bzrlib/tests/__init__.py 2010-09-17 06:59:59 +0000
@@ -4016,6 +4016,18 @@
"""
new_test = copy.copy(test)
new_test.id = lambda: new_id
+ # XXX: Workaround <https://bugs.launchpad.net/testtools/+bug/637725>, which
+ # causes cloned tests to share the 'details' dict. This makes it hard to
+ # read the test output for parameterized tests, because tracebacks will be
+ # associated with irrelevant tests.
+ try:
+ details = new_test._TestCase__details
+ except AttributeError:
+ # must be a different version of testtools than expected. Do nothing.
+ pass
+ else:
+ # Reset the '__details' dict.
+ new_test._TestCase__details = {}
return new_test
=== modified file 'bzrlib/tests/per_interrepository/__init__.py'
--- a/bzrlib/tests/per_interrepository/__init__.py 2010-08-21 16:06:24 +0000
+++ b/bzrlib/tests/per_interrepository/__init__.py 2010-09-17 04:35:23 +0000
@@ -49,7 +49,7 @@
(label, repository_format, repository_format_to).
"""
result = []
- for label, repository_format, repository_format_to in formats:
+ for label, repository_format, repository_format_to, extra_setup in formats:
id = '%s,%s,%s' % (label, repository_format.__class__.__name__,
repository_format_to.__class__.__name__)
scenario = (id,
@@ -57,6 +57,7 @@
"transport_readonly_server": transport_readonly_server,
"repository_format": repository_format,
"repository_format_to": repository_format_to,
+ "extra_setup": extra_setup,
})
result.append(scenario)
return result
@@ -71,8 +72,8 @@
weaverepo,
)
result = []
- def add_combo(label, from_format, to_format):
- result.append((label, from_format, to_format))
+ def add_combo(label, from_format, to_format, extra_setup=None):
+ result.append((label, from_format, to_format, extra_setup))
# test the default InterRepository between format 6 and the current
# default format.
# XXX: robertc 20060220 reinstate this when there are two supported
@@ -89,6 +90,9 @@
# XXX: although we attach InterRepository class names to these scenarios,
# there's nothing asserting that these labels correspond to what is
# actually used.
+ def force_known_graph(testcase):
+ from bzrlib.fetch import Inter1and2Helper
+ testcase.overrideAttr(Inter1and2Helper, 'known_graph_threshold', -1)
add_combo('InterRepository',
weaverepo.RepositoryFormat5(),
knitrepo.RepositoryFormatKnit3())
@@ -113,6 +117,11 @@
add_combo('InterDifferingSerializer',
pack_repo.RepositoryFormatKnitPack1(),
pack_repo.RepositoryFormatKnitPack6RichRoot())
+ add_combo('InterDifferingSerializer+get_known_graph_ancestry',
+ pack_repo.RepositoryFormatKnitPack1(),
+ pack_repo.RepositoryFormatKnitPack6RichRoot(),
+ force_known_graph,
+ )
add_combo('InterDifferingSerializer',
pack_repo.RepositoryFormatKnitPack6RichRoot(),
groupcompress_repo.RepositoryFormat2a())
@@ -132,6 +141,8 @@
def setUp(self):
super(TestCaseWithInterRepository, self).setUp()
+ if self.extra_setup:
+ self.extra_setup(self)
def make_branch(self, relpath, format=None):
repo = self.make_repository(relpath, format=format)
=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py 2010-09-09 18:10:38 +0000
+++ b/bzrlib/tests/test_selftest.py 2010-09-17 04:35:23 +0000
@@ -27,6 +27,7 @@
import warnings
from testtools import MultiTestResult
+from testtools.content import Content
from testtools.content_type import ContentType
from testtools.matchers import (
DocTestMatches,
@@ -43,7 +44,6 @@
lockdir,
memorytree,
osutils,
- progress,
remote,
repository,
symbol_versioning,
@@ -326,19 +326,21 @@
from bzrlib.tests.per_interrepository import make_scenarios
server1 = "a"
server2 = "b"
- formats = [("C0", "C1", "C2"), ("D0", "D1", "D2")]
+ formats = [("C0", "C1", "C2", "C3"), ("D0", "D1", "D2", "D3")]
scenarios = make_scenarios(server1, server2, formats)
self.assertEqual([
('C0,str,str',
{'repository_format': 'C1',
'repository_format_to': 'C2',
'transport_readonly_server': 'b',
- 'transport_server': 'a'}),
+ 'transport_server': 'a',
+ 'extra_setup': 'C3'}),
('D0,str,str',
{'repository_format': 'D1',
'repository_format_to': 'D2',
'transport_readonly_server': 'b',
- 'transport_server': 'a'})],
+ 'transport_server': 'a',
+ 'extra_setup': 'D3'})],
scenarios)
@@ -1676,6 +1678,40 @@
self.assertEqual('original', obj.test_attr)
+class TestTestCloning(tests.TestCase):
+ """Tests that test cloning of TestCases (as used by multiply_tests)."""
+
+ def test_cloned_testcase_does_not_share_details(self):
+ """A TestCase cloned with clone_test does not share mutable attributes
+ such as details or cleanups.
+ """
+ class Test(tests.TestCase):
+ def test_foo(self):
+ self.addDetail('foo', Content('text/plain', lambda: 'foo'))
+ orig_test = Test('test_foo')
+ cloned_test = tests.clone_test(orig_test, orig_test.id() + '(cloned)')
+ orig_test.run(unittest.TestResult())
+ self.assertEqual('foo', orig_test.getDetails()['foo'].iter_bytes())
+ self.assertEqual(None, cloned_test.getDetails().get('foo'))
+
+ def test_double_apply_scenario_preserves_first_scenario(self):
+ """Applying two levels of scenarios to a test preserves the attributes
+ added by both scenarios.
+ """
+ class Test(tests.TestCase):
+ def test_foo(self):
+ pass
+ test = Test('test_foo')
+ scenarios_x = [('x=1', {'x': 1}), ('x=2', {'x': 2})]
+ scenarios_y = [('y=1', {'y': 1}), ('y=2', {'y': 2})]
+ suite = tests.multiply_tests(test, scenarios_x, unittest.TestSuite())
+ suite = tests.multiply_tests(suite, scenarios_y, unittest.TestSuite())
+ all_tests = list(tests.iter_suite_tests(suite))
+ self.assertLength(4, all_tests)
+ all_xys = sorted((t.x, t.y) for t in all_tests)
+ self.assertEqual([(1, 1), (1, 2), (2, 1), (2, 2)], all_xys)
+
+
# NB: Don't delete this; it's not actually from 0.11!
@deprecated_function(deprecated_in((0, 11, 0)))
def sample_deprecated_function():
=== modified file 'bzrlib/xml_serializer.py'
--- a/bzrlib/xml_serializer.py 2010-08-29 18:38:46 +0000
+++ b/bzrlib/xml_serializer.py 2010-09-17 04:35:23 +0000
@@ -33,6 +33,8 @@
from xml.etree.cElementTree import (ElementTree, SubElement, Element,
XMLTreeBuilder, fromstring, tostring)
import xml.etree as elementtree
+ # Also import ElementTree module so monkey-patching below always works
+ import xml.etree.ElementTree
except ImportError:
from cElementTree import (ElementTree, SubElement, Element,
XMLTreeBuilder, fromstring, tostring)
More information about the bazaar-commits
mailing list