Rev 5662: Tweak the tests a bit more. in http://bazaar.launchpad.net/~jameinel/bzr/2.3-gary-bug835035
John Arbash Meinel
john at arbash-meinel.com
Mon Aug 29 17:24:32 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.3-gary-bug835035
------------------------------------------------------------
revno: 5662
revision-id: john at arbash-meinel.com-20110829172405-2irumem9il2jwrx7
parent: john at arbash-meinel.com-20110829171713-wzgck1rue44s95r6
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-gary-bug835035
timestamp: Mon 2011-08-29 19:24:05 +0200
message:
Tweak the tests a bit more.
Pull it out into a separate focused test.
Pull out the common code.
Describe the bug we are checking for.
-------------- next part --------------
=== modified file 'bzrlib/tests/per_repository_reference/__init__.py'
--- a/bzrlib/tests/per_repository_reference/__init__.py 2011-08-29 17:17:13 +0000
+++ b/bzrlib/tests/per_repository_reference/__init__.py 2011-08-29 17:24:05 +0000
@@ -66,26 +66,37 @@
class TestIncompatibleStacking(TestCaseWithRepository):
- def test_add_fallback_repository_rejects_incompatible(self):
- # Repository.add_fallback_repository raises IncompatibleRepositories
- # if you take two repositories in different serializations and try to
- # stack them. If the referring repo is locked, the repo on which
- # it is stacked should not be after the check fails.
+ def make_repo_and_incompatible_fallback(self):
referring = self.make_repository('referring')
if referring._format.supports_chks:
different_fmt = '1.9'
else:
different_fmt = '2a'
- referring.lock_read()
- self.addCleanup(referring.unlock)
- repo = self.make_repository('repo', format=different_fmt)
+ fallback = self.make_repository('fallback', format=different_fmt)
+ return referring, fallback
+
+ def test_add_fallback_repository_rejects_incompatible(self):
+ # Repository.add_fallback_repository raises IncompatibleRepositories
+ # if you take two repositories in different serializations and try to
+ # stack them.
+ referring, fallback = self.make_repo_and_incompatible_fallback()
+ self.assertRaises(errors.IncompatibleRepositories,
+ referring.add_fallback_repository, fallback)
+
+ def test_add_fallback_doesnt_leave_fallback_locked(self):
+ # Bug #835035. If the referring repository is locked, it wants to lock
+ # the fallback repository. But if they are incompatible, the referring
+ # repository won't take ownership of the fallback, and thus should not
+ # leave the repository in a locked state.
+ referring, fallback = self.make_repo_and_incompatible_fallback()
+ self.addCleanup(referring.lock_read().unlock)
# Assert precondition.
- self.assertFalse(repo.is_locked())
+ self.assertFalse(fallback.is_locked())
# Assert action.
self.assertRaises(errors.IncompatibleRepositories,
- referring.add_fallback_repository, repo)
+ referring.add_fallback_repository, fallback)
# Assert postcondition.
- self.assertFalse(repo.is_locked())
+ self.assertFalse(fallback.is_locked())
def external_reference_test_scenarios():
More information about the bazaar-commits
mailing list