Merge lp:~vila/bzr-builddeb/test-failures into lp:bzr-builddeb

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: 509
Proposed branch: lp:~vila/bzr-builddeb/test-failures
Merge into: lp:bzr-builddeb
Diff against target: 66 lines (+23/-0)
2 files modified
tests/test_merge_upstream.py (+22/-0)
tests/test_upstream.py (+1/-0)
To merge this branch: bzr merge lp:~vila/bzr-builddeb/test-failures
Reviewer Review Type Date Requested Status
Jelmer Vernooij Approve
Review via email: mp+48484@code.launchpad.net

Description of the change

This fixes some test failures:

- test_upstream.test_fetch_tarball_repack requires a non-empty zip file (dunno how recent this is, but the test doesn't really care and I don't think we need to support empty zip files)

- some tests in test_merge_upstream.TestUpstreamVersionAddRevision requires a bzr-svn installed, mark them as such.

To post a comment you must log in.
lp:~vila/bzr-builddeb/test-failures updated
510. By Vincent Ladeuil

Fix test failures requiring an installed bzr-svn and the test requiring a non-empty zip file

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

On Thu, 2011-02-03 at 14:49 +0000, Vincent Ladeuil wrote:
> Vincent Ladeuil has proposed merging lp:~vila/bzr-builddeb/test-failures into lp:bzr-builddeb.
>
> Requested reviews:
> Bzr-builddeb-hackers (bzr-builddeb-hackers)
>
> For more details, see:
> https://code.launchpad.net/~vila/bzr-builddeb/test-failures/+merge/48484
>
> This fixes some test failures:
>
> - test_upstream.test_fetch_tarball_repack requires a non-empty zip file (dunno how recent this is, but the test doesn't really care and I don't think we need to support empty zip files)
>
> - some tests in test_merge_upstream.TestUpstreamVersionAddRevision requires a bzr-svn installed, mark them as such.
> differences between files attachment (review-diff.txt)
> === modified file 'tests/test_merge_upstream.py'
> --- tests/test_merge_upstream.py 2011-01-29 03:29:44 +0000
> +++ tests/test_merge_upstream.py 2011-02-03 14:49:08 +0000
> @@ -24,6 +24,7 @@
> # Prior to 0.1.15 the debian module was called debian_bundle
> from debian_bundle.changelog import Version
>
> +from bzrlib import tests
> from bzrlib.revision import Revision
> from bzrlib.tests import TestCase, TestCaseWithTransport
>
> @@ -35,6 +36,22 @@
> upstream_version_add_revision
> )
>
> +# Unless bug #712474 is fixed and available in the minimum bzrlib required, we
> +# can't use:
> +# svn_plugin = tests.ModuleAvailableFeature('bzrlib.plugins.svn')
Can we perhaps check if the minimum bzrlib available is >= 2.3 final and
use it in that case. It'd also just be nice to mention when bug 712474
was fixed, so that it's easy to clean up this workaround later.

Otherwise:

  review approve

Cheers,

Jelmer

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

I'll keep an eye on this in builddeb to clean it up when possible, but the corresponding fix hasn't landed yet in bzr and some bikeshedding may delay it further ;)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_merge_upstream.py'
2--- tests/test_merge_upstream.py 2011-01-29 03:29:44 +0000
3+++ tests/test_merge_upstream.py 2011-02-03 15:17:01 +0000
4@@ -24,6 +24,7 @@
5 # Prior to 0.1.15 the debian module was called debian_bundle
6 from debian_bundle.changelog import Version
7
8+from bzrlib import tests
9 from bzrlib.revision import Revision
10 from bzrlib.tests import TestCase, TestCaseWithTransport
11
12@@ -35,6 +36,22 @@
13 upstream_version_add_revision
14 )
15
16+# Unless bug #712474 is fixed and available in the minimum bzrlib required, we
17+# can't use:
18+# svn_plugin = tests.ModuleAvailableFeature('bzrlib.plugins.svn')
19+class SvnPluginAvailable(tests.Feature):
20+
21+ def feature_name(self):
22+ return 'bzr-svn plugin'
23+
24+ def _probe(self):
25+ try:
26+ import bzrlib.plugins.svn
27+ return True
28+ except ImportError:
29+ return False
30+svn_plugin = SvnPluginAvailable()
31+
32
33 class TestUpstreamVersionAddRevision(TestCaseWithTransport):
34 """Test that updating the version string works."""
35@@ -52,7 +69,11 @@
36 def get_revision(self, revid):
37 rev = Revision(revid)
38 if revid in self.svn_revnos:
39+ self.requireFeature(svn_plugin)
40+ # Fake a bzr-svn revision
41 rev.foreign_revid = ("uuid", "bp", self.svn_revnos[revid])
42+ from bzrlib.plugins.svn import mapping
43+ rev.mapping = mapping.mapping_registry.get_default()()
44 return rev
45
46 def test_update_plus_rev(self):
47@@ -68,6 +89,7 @@
48 upstream_version_add_revision(self, "1.3", "somerev"))
49
50 def test_svn_new_rev(self):
51+
52 self.assertEquals("1.3+svn45",
53 upstream_version_add_revision(self, "1.3", "somesvnrev"))
54
55
56=== modified file 'tests/test_upstream.py'
57--- tests/test_upstream.py 2011-02-02 20:30:13 +0000
58+++ tests/test_upstream.py 2011-02-03 15:17:01 +0000
59@@ -353,6 +353,7 @@
60
61 def test_fetch_tarball_repack(self):
62 zf = zipfile.ZipFile("bla-2.0.zip", "w")
63+ zf.writestr('avoid', 'empty zip to make the repacker happy\n')
64 zf.close()
65 source = TarfileSource("bla-2.0.zip", "2.0")
66 os.mkdir("bar")

Subscribers

People subscribed via source and target branches