Rev 6062: Fix location_to_url tests that needed to watch out for drive letters. in http://bazaar.launchpad.net/~jameinel/bzr/2.5-win32-fixes
John Arbash Meinel
john at arbash-meinel.com
Thu Aug 11 10:23:52 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.5-win32-fixes
------------------------------------------------------------
revno: 6062
revision-id: john at arbash-meinel.com-20110811102339-wxp8x075uhp7drxh
parent: john at arbash-meinel.com-20110811100927-ds6dpklkseeigwg5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.5-win32-fixes
timestamp: Thu 2011-08-11 12:23:39 +0200
message:
Fix location_to_url tests that needed to watch out for drive letters.
-------------- next part --------------
=== 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