Jason R. Coombs avatar Jason R. Coombs committed 239a9c4

Update this test again to ensure it's trapping the expected exception (DistutilsError) and ensuring that it captures the expected error messages.

Comments (0)

Files changed (1)


             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(
         except distutils.errors.DistutilsError, error:
-            # Python 2.7.3
-            self.assert_('getaddrinfo failed' in str(error))
-        except httplib.InvalidURL, error:
-            # Python 2.7.2 and earlier
-            self.assert_('nonnumeric port' in 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(
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.