Rev 4698: (vila) Fix test failures with no C extensions loaded in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Sep 17 11:33:30 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4698 [merge]
revision-id: pqm at pqm.ubuntu.com-20090917103329-khwup105uhik6zje
parent: pqm at pqm.ubuntu.com-20090917094626-nuxn3758mcng932e
parent: v.ladeuil+lp at free.fr-20090917095337-bqea6z0uime66y6q
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2009-09-17 11:33:29 +0100
message:
  (vila) Fix test failures with no C extensions loaded
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_cat.py test_cat.py-20051201162916-f0937e4e19ea24b3
  bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
  bzrlib/tests/blackbox/test_locale.py test_lang.py-20060824204205-80v50j25qkuop7yn-1
  bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
=== modified file 'NEWS'
--- a/NEWS	2009-09-17 09:08:00 +0000
+++ b/NEWS	2009-09-17 09:53:37 +0000
@@ -132,6 +132,8 @@
   to be parameterised. This is not expected to break external use of test
   parameterisation, and is substantially faster. (Robert Collins)
 
+* The full test suite is expected to pass when the C extensions are not
+  present. (Vincent Ladeuil, #430749)
 
 bzr 2.0rc2
 ##########

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-09-14 02:15:45 +0000
+++ b/bzrlib/tests/__init__.py	2009-09-17 09:51:29 +0000
@@ -53,6 +53,7 @@
 from bzrlib import (
     branchbuilder,
     bzrdir,
+    config,
     debug,
     errors,
     hooks,
@@ -2561,6 +2562,14 @@
         super(TestCaseWithTransport, self).setUp()
         self.__vfs_server = None
 
+    def disable_missing_extensions_warning(self):
+        """Some tests expect a precise stderr content.
+
+        There is no point in forcing them to duplicate the extension related
+        warning.
+        """
+        config.GlobalConfig().set_user_option('ignore_missing_extensions', True)
+
 
 class ChrootedTestCase(TestCaseWithTransport):
     """A support class that provides readonly urls outside the local namespace.

=== modified file 'bzrlib/tests/blackbox/test_cat.py'
--- a/bzrlib/tests/blackbox/test_cat.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/tests/blackbox/test_cat.py	2009-09-17 09:51:29 +0000
@@ -22,9 +22,13 @@
 import os
 import sys
 
-from bzrlib.tests.blackbox import TestCaseWithTransport
-
-class TestCat(TestCaseWithTransport):
+from bzrlib import (
+    config,
+    tests,
+    )
+
+
+class TestCat(tests.TestCaseWithTransport):
 
     def test_cat(self):
         tree = self.make_branch_and_tree('branch')
@@ -68,6 +72,7 @@
 
     def test_cat_different_id(self):
         """'cat' works with old and new files"""
+        self.disable_missing_extensions_warning()
         tree = self.make_branch_and_tree('.')
         # the files are named after their path in the revision and
         # current trees later in the test case

=== modified file 'bzrlib/tests/blackbox/test_diff.py'
--- a/bzrlib/tests/blackbox/test_diff.py	2009-06-17 05:11:41 +0000
+++ b/bzrlib/tests/blackbox/test_diff.py	2009-09-17 09:51:29 +0000
@@ -21,11 +21,11 @@
 import os
 import re
 
-import bzrlib
-from bzrlib import workingtree
-from bzrlib.branch import Branch
-from bzrlib.tests import TestSkipped
-from bzrlib.tests.blackbox import ExternalBase
+from bzrlib import (
+    config,
+    tests,
+    workingtree,
+    )
 
 
 def subst_dates(string):
@@ -34,7 +34,7 @@
                   'YYYY-MM-DD HH:MM:SS +ZZZZ', string)
 
 
-class DiffBase(ExternalBase):
+class DiffBase(tests.TestCaseWithTransport):
     """Base class with common setup method"""
 
     def make_example_branch(self):
@@ -355,6 +355,7 @@
 
     def test_external_diff(self):
         """Test that we can spawn an external diff process"""
+        self.disable_missing_extensions_warning()
         # We have to use run_bzr_subprocess, because we need to
         # test writing directly to stdout, (there was a bug in
         # subprocess.py that we had to workaround).
@@ -366,7 +367,7 @@
                                            universal_newlines=True,
                                            retcode=None)
         if 'Diff is not installed on this machine' in err:
-            raise TestSkipped("No external 'diff' is available")
+            raise tests.TestSkipped("No external 'diff' is available")
         self.assertEqual('', err)
         # We have to skip the stuff in the middle, because it depends
         # on time.time()

=== modified file 'bzrlib/tests/blackbox/test_locale.py'
--- a/bzrlib/tests/blackbox/test_locale.py	2009-08-17 22:16:49 +0000
+++ b/bzrlib/tests/blackbox/test_locale.py	2009-09-17 09:51:29 +0000
@@ -19,17 +19,20 @@
 import os
 import sys
 
-from bzrlib.tests import TestCaseWithTransport, TestSkipped
-
-
-class TestLocale(TestCaseWithTransport):
+from bzrlib import (
+    config,
+    tests,
+    )
+
+
+class TestLocale(tests.TestCaseWithTransport):
 
     def setUp(self):
         super(TestLocale, self).setUp()
 
         if sys.platform in ('win32',):
-            raise TestSkipped('Windows does not respond to the LANG'
-                              ' env variable')
+            raise tests.TestSkipped('Windows does not respond to the LANG'
+                                    ' env variable')
 
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/a'])
@@ -41,6 +44,7 @@
         self.tree = tree
 
     def test_log_C(self):
+        self.disable_missing_extensions_warning()
         out, err = self.run_bzr_subprocess(
             '--no-aliases --no-plugins log -q --log-format=long tree',
                env_changes={'LANG':'C', 'BZR_PROGRESS_BAR':'none',

=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py	2009-09-08 03:31:31 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py	2009-09-17 09:51:29 +0000
@@ -25,6 +25,7 @@
 import threading
 
 from bzrlib import (
+    config,
     errors,
     osutils,
     revision as _mod_revision,
@@ -42,6 +43,10 @@
 
 class TestBzrServe(TestCaseWithTransport):
 
+    def setUp(self):
+        super(TestBzrServe, self).setUp()
+        self.disable_missing_extensions_warning()
+
     def assertInetServerShutsdownCleanly(self, process):
         """Shutdown the server process looking for errors."""
         # Shutdown the server: the server should shut down when it cannot read

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2009-09-09 15:27:48 +0000
+++ b/bzrlib/tests/test_selftest.py	2009-09-17 09:51:29 +0000
@@ -28,6 +28,7 @@
 from bzrlib import (
     branchbuilder,
     bzrdir,
+    config,
     debug,
     errors,
     lockdir,
@@ -2369,6 +2370,7 @@
         """finish_bzr_subprocess raises self.failureException if the retcode is
         not the expected one.
         """
+        self.disable_missing_extensions_warning()
         process = self.start_bzr_subprocess(['wait-until-signalled'],
                                             skip_if_plan_to_signal=True)
         self.assertEqual('running\n', process.stdout.readline())




More information about the bazaar-commits mailing list