Rev 6061: (vila) Small test suite fixes for Windows. (John A Meinel) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Aug 11 18:50:01 UTC 2011


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

------------------------------------------------------------
revno: 6061 [merge]
revision-id: pqm at pqm.ubuntu.com-20110811184954-7z846r214w274v8h
parent: pqm at pqm.ubuntu.com-20110809170446-f1wc1a8fhgnxi4cn
parent: john at arbash-meinel.com-20110811103351-vbkk4l1cq905u67d
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2011-08-11 18:49:54 +0000
message:
  (vila) Small test suite fixes for Windows. (John A Meinel)
modified:
  bzrlib/tests/features.py       features.py-20090820042958-jglgza3wrn03ha9e-1
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
  bzrlib/tests/test_transport.py testtransport.py-20050718175618-e5cdb99f4555ddce
=== modified file 'bzrlib/tests/features.py'
--- a/bzrlib/tests/features.py	2011-07-25 02:38:30 +0000
+++ b/bzrlib/tests/features.py	2011-08-11 10:09:27 +0000
@@ -18,6 +18,7 @@
 """
 
 import os
+import subprocess
 import stat
 import sys
 import tempfile

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2011-08-06 03:52:34 +0000
+++ b/bzrlib/tests/test_selftest.py	2011-08-11 10:33:51 +0000
@@ -1062,7 +1062,7 @@
                 self.expectFailure("No absolute truth", self.assertTrue, True)
         runner = tests.TextTestRunner(stream=StringIO())
         result = self.run_test_runner(runner, Test("test_truth"))
-        if testtools_version <= (0, 9, 11):
+        if testtools_version[:3] <= (0, 9, 11):
             self.assertContainsRe(runner.stream.getvalue(),
                 "=+\n"
                 "FAIL: \\S+\.test_truth\n"
@@ -1251,7 +1251,7 @@
             lambda trace=False: "ascii")
         result = self.run_test_runner(tests.TextTestRunner(stream=out),
             FailureWithUnicode("test_log_unicode"))
-        if testtools_version > (0, 9, 11):
+        if testtools_version[:3] > (0, 9, 11):
             self.assertContainsRe(out.getvalue(), "log: {{{\d+\.\d+  \\\\u2606}}}")
         else:
             self.assertContainsRe(out.getvalue(),

=== modified file 'bzrlib/tests/test_transport.py'
--- a/bzrlib/tests/test_transport.py	2011-08-08 12:44:51 +0000
+++ b/bzrlib/tests/test_transport.py	2011-08-11 10:23:39 +0000
@@ -1058,6 +1058,16 @@
 
 class TestLocationToUrl(tests.TestCase):
 
+    def get_base_location(self):
+        path = osutils.abspath('/foo/bar')
+        if path.startswith('/'):
+            url = 'file://%s' % (path,)
+        else:
+            # On Windows, abspaths start with the drive letter, so we have to
+            # add in the extra '/'
+            url = 'file:///%s' % (path,)
+        return path, url
+
     def test_regular_url(self):
         self.assertEquals("file://foo", location_to_url("file://foo"))
 
@@ -1071,11 +1081,14 @@
             "http://fo/\xc3\xaf".decode("utf-8"))
 
     def test_unicode_path(self):
-        self.assertEquals("file:///foo/bar%C3%AF",
-            location_to_url("/foo/bar\xc3\xaf".decode("utf-8")))
+        path, url = self.get_base_location()
+        location = path + "\xc3\xaf".decode("utf-8")
+        url += '%C3%AF'
+        self.assertEquals(url, location_to_url(location))
 
     def test_path(self):
-        self.assertEquals("file:///foo/bar", location_to_url("/foo/bar"))
+        path, url = self.get_base_location()
+        self.assertEquals(url, location_to_url(path))
 
     def test_relative_file_url(self):
         self.assertEquals(urlutils.local_path_to_url(".") + "/bar",




More information about the bazaar-commits mailing list