diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2012-07-22 16:26:37 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2012-07-22 16:26:37 -0400 |
| commit | 70285f438a5250bb14b78ba2af55e2dea0de4fd4 (patch) | |
| tree | 1a78a2318799639bf2ec1e3c3504e741bc4b8c07 /setuptools/tests/test_packageindex.py | |
| parent | 246db5a5dc9d41d2dc5767dfac89d4a295a08f1b (diff) | |
| download | python-setuptools-bitbucket-70285f438a5250bb14b78ba2af55e2dea0de4fd4.tar.gz | |
Update this test again to ensure it's trapping the expected exception (DistutilsError) and ensuring that it captures the expected error messages.
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
| -rw-r--r-- | setuptools/tests/test_packageindex.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 5e424dd6..09e78bb3 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -60,6 +60,9 @@ class TestPackageIndex(unittest.TestCase): 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',) ) @@ -69,11 +72,9 @@ class TestPackageIndex(unittest.TestCase): try: index.open_url(url) 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( |
