Commits

Jason R. Coombs  committed 6178d0a Merge

Merge

  • Participants
  • Parent commits 9962b51, 239a9c4

Comments (0)

Files changed (1)

File setuptools/tests/test_packageindex.py

             urllib2.urlopen = old_urlopen
 
     def test_bad_url_double_scheme(self):
+        """
+        A bad URL with a double scheme should raise a DistutilsError.
+        """
         index = setuptools.package_index.PackageIndex(
             hosts=('www.example.com',)
         )
         try:
             index.open_url(url)
         except distutils.errors.DistutilsError, error:
-            # Python 2.7.3
-            self.assertTrue('getaddrinfo failed' in str(error), "error was " +
-                str(error))
-        except httplib.InvalidURL, error:
-            # Python 2.7.2 and earlier
-            self.assertTrue('nonnumeric port' in str(error), "error was " +
-                str(error))
+            msg = unicode(error)
+            assert 'nonnumeric port' in msg or 'getaddrinfo failed' in msg
+        raise RuntimeError("Did not raise")
 
     def test_bad_url_screwy_href(self):
         index = setuptools.package_index.PackageIndex(