Merge lp:~jelmer/brz/print-warnings into lp:brz/3.0

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/print-warnings
Merge into: lp:brz/3.0
Diff against target: 60 lines (+7/-1)
1 file modified
breezy/git/tests/test_branch.py (+7/-1)
To merge this branch: bzr merge lp:~jelmer/brz/print-warnings
Reviewer Review Type Date Requested Status
Martin Packman Approve
Review via email: mp+363702@code.launchpad.net

Commit message

Check for specific warning rather than total number of warnings.

Description of the change

Check for specific warning rather than total number of warnings.

Also, fix some resource warnings from leaving git repositories open.

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

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'breezy/git/tests/test_branch.py'
--- breezy/git/tests/test_branch.py 2019-01-19 17:13:53 +0000
+++ breezy/git/tests/test_branch.py 2019-02-27 01:45:47 +0000
@@ -112,6 +112,7 @@
112 reva = self.simple_commit_a()112 reva = self.simple_commit_a()
113 self.build_tree(['b'])113 self.build_tree(['b'])
114 r = GitRepo(".")114 r = GitRepo(".")
115 self.addCleanup(r.close)
115 r.stage("b")116 r.stage("b")
116 revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>")117 revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>")
117118
@@ -129,6 +130,7 @@
129 o.tag_timezone = 0130 o.tag_timezone = 0
130 o.tag_time = 42131 o.tag_time = 42
131 r = GitRepo(".")132 r = GitRepo(".")
133 self.addCleanup(r.close)
132 r.object_store.add_object(o)134 r.object_store.add_object(o)
133 r[b'refs/tags/foo'] = o.id135 r[b'refs/tags/foo'] = o.id
134 thebranch = Branch.open('.')136 thebranch = Branch.open('.')
@@ -138,6 +140,7 @@
138 def test_tag(self):140 def test_tag(self):
139 reva = self.simple_commit_a()141 reva = self.simple_commit_a()
140 r = GitRepo(".")142 r = GitRepo(".")
143 self.addCleanup(r.close)
141 r.refs[b"refs/tags/foo"] = reva144 r.refs[b"refs/tags/foo"] = reva
142 thebranch = Branch.open('.')145 thebranch = Branch.open('.')
143 self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},146 self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
@@ -221,6 +224,7 @@
221 def test_sprouted_tags(self):224 def test_sprouted_tags(self):
222 path, gitsha = self.make_onerev_branch()225 path, gitsha = self.make_onerev_branch()
223 r = GitRepo(path)226 r = GitRepo(path)
227 self.addCleanup(r.close)
224 r.refs[b"refs/tags/lala"] = r.head()228 r.refs[b"refs/tags/lala"] = r.head()
225 oldrepo = Repository.open(path)229 oldrepo = Repository.open(path)
226 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)230 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
@@ -231,6 +235,7 @@
231 def test_sprouted_ghost_tags(self):235 def test_sprouted_ghost_tags(self):
232 path, gitsha = self.make_onerev_branch()236 path, gitsha = self.make_onerev_branch()
233 r = GitRepo(path)237 r = GitRepo(path)
238 self.addCleanup(r.close)
234 r.refs[b"refs/tags/lala"] = b"aa" * 20239 r.refs[b"refs/tags/lala"] = b"aa" * 20
235 oldrepo = Repository.open(path)240 oldrepo = Repository.open(path)
236 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)241 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
@@ -238,7 +243,7 @@
238 self.clone_git_branch, path, "f")243 self.clone_git_branch, path, "f")
239 self.assertEqual({}, newbranch.tags.get_tag_dict())244 self.assertEqual({}, newbranch.tags.get_tag_dict())
240 # Dulwich raises a UserWarning for tags with invalid target245 # Dulwich raises a UserWarning for tags with invalid target
241 self.assertEqual(1, len(warnings))246 self.assertIn(('ref refs/tags/lala points at non-present sha ' + ("aa" * 20), ), [w.args for w in warnings])
242247
243 def test_interbranch_pull(self):248 def test_interbranch_pull(self):
244 path, (gitsha1, gitsha2) = self.make_tworev_branch()249 path, (gitsha1, gitsha2) = self.make_tworev_branch()
@@ -272,6 +277,7 @@
272 def test_interbranch_pull_with_tags(self):277 def test_interbranch_pull_with_tags(self):
273 path, (gitsha1, gitsha2) = self.make_tworev_branch()278 path, (gitsha1, gitsha2) = self.make_tworev_branch()
274 gitrepo = GitRepo(path)279 gitrepo = GitRepo(path)
280 self.addCleanup(gitrepo.close)
275 gitrepo.refs[b"refs/tags/sometag"] = gitsha2281 gitrepo.refs[b"refs/tags/sometag"] = gitsha2
276 oldrepo = Repository.open(path)282 oldrepo = Repository.open(path)
277 revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1)283 revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1)

Subscribers

People subscribed via source and target branches