Merge lp:~jelmer/brz/spurious-544 into lp:brz

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merge reported by: The Breezy Bot
Merged at revision: not available
Proposed branch: lp:~jelmer/brz/spurious-544
Merge into: lp:brz
Diff against target: 61 lines (+32/-7)
1 file modified
breezy/tests/blackbox/test_tags.py (+32/-7)
To merge this branch: bzr merge lp:~jelmer/brz/spurious-544
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+361407@code.launchpad.net

Commit message

Fix spurious failures in test_list_tags_dotted_revnos_unsupported.

Description of the change

Fix spurious failures in test_list_tags_dotted_revnos_unsupported.

This uses a custom branch format rather than monkey patching.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good, thanks!

review: Approve
Revision history for this message
The Breezy Bot (the-breezy-bot) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/tests/blackbox/test_tags.py'
2--- breezy/tests/blackbox/test_tags.py 2018-11-11 04:08:32 +0000
3+++ breezy/tests/blackbox/test_tags.py 2019-01-08 21:29:44 +0000
4@@ -17,10 +17,17 @@
5 """Tests for commands related to tags"""
6
7 from breezy import (
8+ branch as _mod_branch,
9 errors,
10+ lockable_files,
11+ lockdir,
12 tag,
13 transform,
14 )
15+from breezy.bzr import (
16+ branch as bzrbranch,
17+ bzrdir,
18+ )
19 from breezy.branch import (
20 Branch,
21 )
22@@ -272,15 +279,33 @@
23 self.assertContainsRe(out, r'tagD *3\n')
24
25 def test_list_tags_dotted_revnos_unsupported(self):
26- tree = self.make_branch_and_tree('branch')
27+ class TrimmedBranch(bzrbranch.BzrBranch6):
28+
29+ def revision_id_to_dotted_revno(self, revid):
30+ raise errors.UnsupportedOperation(
31+ self.revision_id_to_dotted_revno, self)
32+
33+ class TrimmedBranchFormat(bzrbranch.BzrBranchFormat6):
34+
35+ def _branch_class(self):
36+ return TrimmedBranch
37+
38+ @classmethod
39+ def get_format_string(cls):
40+ return b"Trimmed Branch"
41+
42+
43+ _mod_branch.format_registry.register(TrimmedBranchFormat())
44+ self.addCleanup(_mod_branch.format_registry.remove,
45+ TrimmedBranchFormat())
46+
47+ dir_format = bzrdir.BzrDirMetaFormat1()
48+ dir_format._branch_format = TrimmedBranchFormat()
49+
50+ tree = self.make_branch_and_tree('branch', format=dir_format)
51+ self.assertFileEqual('Trimmed Branch', 'branch/.bzr/branch/format')
52 rev1 = tree.commit("rev1")
53 tree.branch.tags.set_tag("mytag", rev1)
54-
55- def revision_id_to_dotted_revno(self, revid):
56- raise errors.UnsupportedOperation(
57- revision_id_to_dotted_revno, self)
58- self.overrideAttr(Branch, "revision_id_to_dotted_revno",
59- revision_id_to_dotted_revno)
60 out, err = self.run_bzr('tags -d branch', encoding='utf-8')
61 self.assertEqual(out, 'mytag ?\n')
62

Subscribers

People subscribed via source and target branches