diff options
author | Jim Fulton <distutils-sig@python.org> | 2007-03-09 15:56:51 +0000 |
---|---|---|
committer | Jim Fulton <distutils-sig@python.org> | 2007-03-09 15:56:51 +0000 |
commit | 89111e6143f3a9bb510433f529d4281681b7c66e (patch) | |
tree | 15b86e76d67a73b14db6d38a422bc9c4dcba408d | |
parent | 08f3761c19825414ef0d33f584a667444ccb5523 (diff) | |
download | external_python_setuptools-89111e6143f3a9bb510433f529d4281681b7c66e.tar.gz external_python_setuptools-89111e6143f3a9bb510433f529d4281681b7c66e.tar.bz2 external_python_setuptools-89111e6143f3a9bb510433f529d4281681b7c66e.zip |
Changed setuptools.package_index.PackageIndex.open_url to include the
url in the exception.
--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4054241
-rwxr-xr-x | setuptools/package_index.py | 4 | ||||
-rw-r--r-- | setuptools/tests/test_packageindex.py | 19 |
2 files changed, 22 insertions, 1 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py index e4d7e6b9..e4f96f0b 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -581,7 +581,9 @@ class PackageIndex(Environment): return v except urllib2.URLError, v: if warning: self.warn(warning, v.reason) - else: raise DistutilsError("Download error: %s" % v.reason) + else: + raise DistutilsError("Download error for %s: %s" + % (url, v.reason)) def _download_url(self, scheme, url, tmpdir): # Determine download filename diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py new file mode 100644 index 00000000..a2ca36ad --- /dev/null +++ b/setuptools/tests/test_packageindex.py @@ -0,0 +1,19 @@ +"""Package Index Tests +""" +# More would be better! + +import os, shutil, tempfile, unittest +import pkg_resources +import setuptools.package_index + +class TestPackageIndex(unittest.TestCase): + + def test_bad_urls(self): + index = setuptools.package_index.PackageIndex() + url = 'http://127.0.0.1/nonesuch/test_package_index' + try: + index.open_url(url) + except Exception, v: + self.assert_(url in str(v)) + else: + self.assert_(False) |