[Pkg-bazaar-commits] ./bzr-builddeb/trunk r335: Merge test fixes from vila.

James Westby james.westby at canonical.com
Sat Jul 4 20:48:56 UTC 2009


------------------------------------------------------------
revno: 335
committer: James Westby <james.westby at canonical.com>
branch nick: trunk
timestamp: Mon 2009-03-30 13:36:20 +0100
message:
  Merge test fixes from vila.
modified:
  changes.py
  cmds.py
  tests/blackbox/test_import_dsc.py
  tests/test_import_dsc.py
    ------------------------------------------------------------
    revno: 334.1.1
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Mon 2009-03-16 16:52:52 +0100
    message:
      Fix test failures.
      
      * cmds.py: 
      Fix help strings to comply with bzr grammar rules.
      
      * changes.py:
      (DebianChanges.__init__): Fixed test failure when selftest is not
      run in the plugin directory.
    modified:
      changes.py
      cmds.py
    ------------------------------------------------------------
    revno: 334.1.2
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: trunk
    timestamp: Mon 2009-03-16 17:22:41 +0100
    message:
      Make 'pristine-tar' a test feature to avoid spurius failures.
      
      * tests/test_import_dsc.py:
      (PristineTarFeature): New feature to avoid test failures when
      pristine-tar is not installed.
      
      * tests/blackbox/test_import_dsc.py: 
      Use PristineTarFeature.
    modified:
      tests/blackbox/test_import_dsc.py
      tests/test_import_dsc.py
-------------- next part --------------
=== modified file 'changes.py'
--- a/changes.py	2008-08-26 15:41:59 +0000
+++ b/changes.py	2009-03-16 15:52:52 +0000
@@ -28,12 +28,13 @@
 from bzrlib.plugins.builddeb.errors import DebianError, MissingChanges
 
 class DebianChanges(deb822.Changes):
-  """Abstraction of the .changes file. Use it to find out what files were 
-  built."""
+  """Abstraction of the .changes file used to find out what files were built."""
 
   def __init__(self, package, version, dir, arch=None):
     """
-    >>> c = DebianChanges('bzr-builddeb', '0.1-1', None, 'i386')
+    >>> import os.path
+    >>> file_dir = os.path.dirname(__file__)
+    >>> c = DebianChanges('bzr-builddeb', '0.1-1', file_dir, 'i386')
     >>> fs = c.files()
     >>> f = fs[0]
     >>> f['name']
@@ -61,7 +62,7 @@
     fp = open(changes)
     deb822.Changes.__init__(self, fp)
     self._filename = changes
-    
+
   def files(self):
     return self['Files']
 
@@ -75,5 +76,5 @@
 
 if __name__ == "__main__":
   _test()
-  
+
 # vim: ts=2 sts=2 sw=2

=== modified file 'cmds.py'
--- a/cmds.py	2009-03-04 13:05:56 +0000
+++ b/cmds.py	2009-03-16 15:52:52 +0000
@@ -82,31 +82,31 @@
         )
 
 dont_purge_opt = Option('dont-purge',
-    help="Don't purge the build directory after building")
+    help="Don't purge the build directory after building.")
 result_opt = Option('result-dir',
-    help="Directory in which to place the resulting package files", type=str)
+    help="Directory in which to place the resulting package files.", type=str)
 builder_opt = Option('builder',
-    help="Command to build the package", type=str)
+    help="Command to build the package.", type=str)
 merge_opt = Option('merge',
-    help='Merge the debian part of the source in to the upstream tarball')
+    help='Merge the debian part of the source in to the upstream tarball.')
 split_opt = Option('split',
-    help="Automatically create an .orig.tar.gz from a full source branch")
+    help="Automatically create an .orig.tar.gz from a full source branch.")
 build_dir_opt = Option('build-dir',
-    help="The dir to use for building", type=str)
+    help="The dir to use for building.", type=str)
 orig_dir_opt = Option('orig-dir',
     help="Directory containing the .orig.tar.gz files. For use when only"
-       +"debian/ is versioned", type=str)
+       +"debian/ is versioned.", type=str)
 native_opt = Option('native',
-    help="Build a native package")
+    help="Build a native package.")
 export_upstream_opt = Option('export-upstream',
-    help="Create the .orig.tar.gz from a bzr branch before building",
+    help="Create the .orig.tar.gz from a bzr branch before building.",
     type=unicode)
 export_upstream_revision_opt = Option('export-upstream-revision',
-    help="Select the upstream revision that will be exported",
+    help="Select the upstream revision that will be exported.",
     type=str)
 no_user_conf_opt = Option('no-user-config',
     help="Stop builddeb from reading the user's config file. Used mainly "
-    "for tests")
+    "for tests.")
 
 
 def debuild_config(tree, working_tree, no_user_config):
@@ -141,10 +141,10 @@
     If BRANCH is specified it is assumed that the branch you wish to build is
     located there. If it is not specified then the current directory is used.
 
-    By default the if a working tree is found it is used to build and otherwise
-    the last committed revision was used. To force building the last committed 
-    revision use --revision -1. You can specify any other revision using the 
-    --revision option.
+    By default, if a working tree is found, it is used to build. Otherwise the
+    last committed revision found in the branch is used. To force building the
+    last committed revision use --revision -1. You can also specify any other
+    revision with the --revision option.
 
     If you only wish to export the package, and not build it (especially useful
     for merge mode), use --export-only.
@@ -176,20 +176,21 @@
     debian/rules binary'. It is overriden if --builder is passed. Using this
     and --reuse allows for fast rebuilds.
     """
-    working_tree_opt = Option('working-tree', help="This option has no effect",
+    working_tree_opt = Option('working-tree', help="This option has no effect.",
                               short_name='w')
-    export_only_opt = Option('export-only', help="Export only, don't build",
+    export_only_opt = Option('export-only', help="Export only, don't build.",
                              short_name='e')
     use_existing_opt = Option('use-existing',
-                              help="Use an existing build directory")
+                              help="Use an existing build directory.")
     quick_opt = Option('quick', help="Quickly build the package, uses "
                        +"quick-builder, which defaults to \"fakeroot "
-                       +"debian/rules binary\"")
-    reuse_opt = Option('reuse', help="Try to avoid expoting too much on each "
+                       +"debian/rules binary\".")
+    reuse_opt = Option('reuse', help="Try to avoid exporting too much on each "
                        +"build. Only works in merge mode; it saves unpacking "
                        +"the upstream tarball each time. Implies --dont-purge "
-                       +"and --use-existing")
-    source_opt = Option('source', help="Build a source package", short_name='S')
+                       +"and --use-existing.")
+    source_opt = Option('source', help="Build a source package.",
+                        short_name='S')
     result_compat_opt = Option('result', help="Present only for compatibility "
             "with bzr-builddeb <= 2.0. Use --result-dir instead.")
     takes_args = ['branch_or_build_options*']
@@ -450,8 +451,9 @@
     version_opt = Option('version', help="The version number of this release.",
                          type=str)
     distribution_opt = Option('distribution', help="The distribution that "
-            "this release is targetted at", type=str)
-    directory_opt = Option('directory', help='Working tree into which to merge.',
+            "this release is targetted at.", type=str)
+    directory_opt = Option('directory',
+                           help='Working tree into which to merge.',
                            short_name='d', type=unicode)
 
     takes_options = [package_opt, no_user_conf_opt, version_opt,

=== modified file 'tests/blackbox/test_import_dsc.py'
--- a/tests/blackbox/test_import_dsc.py	2009-02-19 11:13:09 +0000
+++ b/tests/blackbox/test_import_dsc.py	2009-03-16 16:22:41 +0000
@@ -23,7 +23,10 @@
 import subprocess
 import tarfile
 
+from bzrlib import tests
+
 from bzrlib.plugins.builddeb.tests import BuilddebTestCase
+from bzrlib.plugins.builddeb.tests.test_import_dsc import PristineTarFeature
 
 
 class TestImportDsc(BuilddebTestCase):
@@ -72,6 +75,7 @@
     shutil.rmtree(self.upstream_dir)
 
   def test_import_dsc(self):
+    self.requireFeature(PristineTarFeature)
     self.make_real_source_package()
     tree = self.make_branch_and_tree('.')
     self.run_bzr('import-dsc %s' % self.dsc_name)

=== modified file 'tests/test_import_dsc.py'
--- a/tests/test_import_dsc.py	2009-03-10 01:57:05 +0000
+++ b/tests/test_import_dsc.py	2009-03-16 16:22:41 +0000
@@ -20,12 +20,15 @@
 #
 
 import os
+import os.path
 import shutil
 
 from debian_bundle.changelog import Version
 
-from bzrlib.errors import DivergedBranches
-from bzrlib.tests import TestCaseWithTransport, KnownFailure
+from bzrlib import (
+  errors,
+  tests,
+  )
 
 from bzrlib.plugins.builddeb.import_dsc import (
         DistributionBranch,
@@ -34,6 +37,18 @@
 from bzrlib.plugins.builddeb.tests import SourcePackageBuilder
 
 
+class _PristineTarFeature(tests.Feature):
+
+  def feature_name(self):
+    return '/usr/bin/pristine-tar'
+
+  def _probe(self):
+    return os.path.exists("/usr/bin/pristine-tar")
+
+
+PristineTarFeature = _PristineTarFeature()
+
+
 def write_to_file(filename, contents):
   f = open(filename, 'wb')
   try:
@@ -42,7 +57,7 @@
     f.close()
 
 
-class DistributionBranchTests(TestCaseWithTransport):
+class DistributionBranchTests(tests.TestCaseWithTransport):
 
     def setUp(self):
         super(DistributionBranchTests, self).setUp()
@@ -796,6 +811,7 @@
                 modified=["README"])
 
     def test_import_package_init_from_other(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("0.1-1")
         version2 = Version("0.2-1")
         builder = SourcePackageBuilder("package", version1)
@@ -820,6 +836,7 @@
         self.assertEqual(len(self.tree1.branch.revision_history()), 2)
 
     def test_import_package_double(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("0.1-1")
         version2 = Version("0.2-1")
         builder = SourcePackageBuilder("package", version1)
@@ -881,6 +898,7 @@
         self.assertEqual(props["deb-thanks"], "Bar\nFoo <foo at foo.org>")
 
     def test_import_two_roots(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("0.1-0ubuntu1")
         version2 = Version("0.2-1")
         builder = SourcePackageBuilder("package", version1)
@@ -920,6 +938,7 @@
                 modified=["README"])
 
     def test_sync_to_other_branch(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("0.1-1")
         version2 = Version("0.1-1ubuntu1")
         version3 = Version("0.2-1")
@@ -968,6 +987,7 @@
                 modified=["README", "debian/changelog"])
 
     def test_pull_from_other(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("0.1-1")
         version2 = Version("0.2-1")
         version3 = Version("0.3-1")
@@ -984,8 +1004,8 @@
         self.db1.import_package(builder.dsc_name())
         try:
             self.db2.import_package(builder.dsc_name())
-        except DivergedBranches:
-            raise KnownFailure("Pulling from another branch after "
+        except errors.DivergedBranches:
+            raise tests.KnownFailure("Pulling from another branch after "
                     "merge the other way fails due to assuming the "
                     "upstream branch can be pulled too, but we never "
                     "merge upstream branches.")
@@ -1082,6 +1102,7 @@
         self.assertTrue(self.db1.is_version_native(version2))
 
     def test_import_non_native_to_native(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("1.0-1")
         version2 = Version("1.0-2")
         builder = SourcePackageBuilder("package", version1)
@@ -1118,6 +1139,7 @@
         self.assertTrue(self.db1.is_version_native(version2))
 
     def test_import_native_to_non_native(self):
+        self.requireFeature(PristineTarFeature)
         version1 = Version("1.0")
         version2 = Version("1.1-1")
         builder = SourcePackageBuilder("package", version1, native=True)
@@ -1173,6 +1195,7 @@
         version we assume that it was accidental, and so don't include
         the native revision in the upstream branch's history.
         """
+        self.requireFeature(PristineTarFeature)
         version1 = Version("1.0-1")
         version2 = Version("1.0-2")
         version3 = Version("1.0-3")
@@ -1219,6 +1242,7 @@
         As we get a new upstream we want to link that to the previous
         upstream.
         """
+        self.requireFeature(PristineTarFeature)
         version1 = Version("1.0-1")
         version2 = Version("1.0-2")
         version3 = Version("1.1-1")
@@ -1271,6 +1295,7 @@
         the second version's packaging branch revision as the second
         parent).
         """
+        self.requireFeature(PristineTarFeature)
         version1 = Version("1.0-1")
         version2 = Version("1.1")
         version3 = Version("1.2-1")



More information about the Pkg-bazaar-commits mailing list