[Zope-CVS] SVN: zpkgtools/trunk/zpkgtools/tests/test_lo be more careful with cross-platform path->URL transformation

Fred L. Drake, Jr. fdrake at gmail.com
Fri Sep 17 15:01:48 EDT 2004


Log message for revision 27620:
  be more careful with cross-platform path->URL transformation


Changed:
  U   zpkgtools/trunk/zpkgtools/tests/test_loader.py
  U   zpkgtools/trunk/zpkgtools/tests/test_locationmap.py


-=-
Modified: zpkgtools/trunk/zpkgtools/tests/test_loader.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_loader.py	2004-09-17 18:05:51 UTC (rev 27619)
+++ zpkgtools/trunk/zpkgtools/tests/test_loader.py	2004-09-17 19:01:48 UTC (rev 27620)
@@ -20,6 +20,7 @@
 import urllib
 
 from zpkgsetup.tests import tempfileapi as tempfile
+from zpkgsetup import urlutils
 
 from zpkgtools import loader
 from zpkgtools.tests import test_svnloader
@@ -130,7 +131,7 @@
 
     def test_load_with_file(self):
         filename = os.path.abspath(__file__)
-        URL = "file://" + urllib.pathname2url(filename)
+        URL = urlutils.file_url(filename)
         loader = self.createLoader()
         # Check that the file isn't copied if we don't ask for a mutable copy:
         p1 = loader.load(URL)
@@ -141,7 +142,7 @@
 
     def test_load_mutable_copy_with_file(self):
         filename = os.path.abspath(__file__)
-        URL = "file://" + urllib.pathname2url(filename)
+        URL = urlutils.file_url(filename)
         loader = self.createLoader()
         # Check that the file isn't copied if we don't ask for a mutable copy:
         p1 = loader.load(URL)
@@ -167,11 +168,11 @@
         self.check_load_mutable_copy_with_directory(filename)
 
     def check_load_mutable_copy_with_directory(self, filename):
-        URL = "file://" + urllib.pathname2url(filename)
+        URL = urlutils.file_url(filename)
         loader = self.createLoader()
         # Check that the file isn't copied if we don't ask for a mutable copy:
         p1 = loader.load(URL)
-        self.assertEqual(p1, filename)
+        self.assertEqual(p1, os.path.normpath(filename))
         # Check that it is copied if we do:
         common_files = [
             "packages.map",

Modified: zpkgtools/trunk/zpkgtools/tests/test_locationmap.py
===================================================================
--- zpkgtools/trunk/zpkgtools/tests/test_locationmap.py	2004-09-17 18:05:51 UTC (rev 27619)
+++ zpkgtools/trunk/zpkgtools/tests/test_locationmap.py	2004-09-17 19:01:48 UTC (rev 27620)
@@ -21,6 +21,7 @@
 from StringIO import StringIO
 
 from zpkgsetup import loggingapi as logging
+from zpkgsetup import urlutils
 
 from zpkgtools import locationmap
 from zpkgtools.tests.test_cvsloader import CvsWorkingDirectoryBase
@@ -95,9 +96,9 @@
         dirname = os.path.dirname(os.path.abspath(__file__))
         dirname = os.path.join(dirname, "input")
         fn = os.path.join(dirname, "packages.map")
-        url = "file://" + urllib.pathname2url(fn)
+        url = urlutils.file_url(fn)
         map = locationmap.fromPathOrUrl(url)
-        base = "file://" + urllib.pathname2url(dirname)
+        base = urlutils.file_url(dirname)
         self.assertEqual(map["collection:collection-1"],
                          base + "/collection-1/")
         self.assertEqual(map["collection:collection-2"],



More information about the Zope-CVS mailing list