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

Proposed by Jelmer Vernooij on 2019-02-27
Status: Merged
Approved by: Jelmer Vernooij on 2019-03-03
Approved revision: 7290
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 2019-02-27 Approve on 2019-03-03
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.
Martin Packman (gz) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'breezy/git/tests/test_branch.py'
2--- breezy/git/tests/test_branch.py 2019-01-19 17:13:53 +0000
3+++ breezy/git/tests/test_branch.py 2019-02-27 01:45:47 +0000
4@@ -112,6 +112,7 @@
5 reva = self.simple_commit_a()
6 self.build_tree(['b'])
7 r = GitRepo(".")
8+ self.addCleanup(r.close)
9 r.stage("b")
10 revb = r.do_commit(b"b", committer=b"Somebody <foo@example.com>")
11
12@@ -129,6 +130,7 @@
13 o.tag_timezone = 0
14 o.tag_time = 42
15 r = GitRepo(".")
16+ self.addCleanup(r.close)
17 r.object_store.add_object(o)
18 r[b'refs/tags/foo'] = o.id
19 thebranch = Branch.open('.')
20@@ -138,6 +140,7 @@
21 def test_tag(self):
22 reva = self.simple_commit_a()
23 r = GitRepo(".")
24+ self.addCleanup(r.close)
25 r.refs[b"refs/tags/foo"] = reva
26 thebranch = Branch.open('.')
27 self.assertEqual({"foo": default_mapping.revision_id_foreign_to_bzr(reva)},
28@@ -221,6 +224,7 @@
29 def test_sprouted_tags(self):
30 path, gitsha = self.make_onerev_branch()
31 r = GitRepo(path)
32+ self.addCleanup(r.close)
33 r.refs[b"refs/tags/lala"] = r.head()
34 oldrepo = Repository.open(path)
35 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
36@@ -231,6 +235,7 @@
37 def test_sprouted_ghost_tags(self):
38 path, gitsha = self.make_onerev_branch()
39 r = GitRepo(path)
40+ self.addCleanup(r.close)
41 r.refs[b"refs/tags/lala"] = b"aa" * 20
42 oldrepo = Repository.open(path)
43 revid = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha)
44@@ -238,7 +243,7 @@
45 self.clone_git_branch, path, "f")
46 self.assertEqual({}, newbranch.tags.get_tag_dict())
47 # Dulwich raises a UserWarning for tags with invalid target
48- self.assertEqual(1, len(warnings))
49+ self.assertIn(('ref refs/tags/lala points at non-present sha ' + ("aa" * 20), ), [w.args for w in warnings])
50
51 def test_interbranch_pull(self):
52 path, (gitsha1, gitsha2) = self.make_tworev_branch()
53@@ -272,6 +277,7 @@
54 def test_interbranch_pull_with_tags(self):
55 path, (gitsha1, gitsha2) = self.make_tworev_branch()
56 gitrepo = GitRepo(path)
57+ self.addCleanup(gitrepo.close)
58 gitrepo.refs[b"refs/tags/sometag"] = gitsha2
59 oldrepo = Repository.open(path)
60 revid1 = oldrepo.get_mapping().revision_id_foreign_to_bzr(gitsha1)

Subscribers

People subscribed via source and target branches