aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_packageindex.py
diff options
context:
space:
mode:
authortarek <none@none>2009-08-26 08:42:44 +0200
committertarek <none@none>2009-08-26 08:42:44 +0200
commit0ae5113b9bc5824a09b0e2c4e317084a4402cc0c (patch)
treece06a09a47cb8327c9d9fe6ca0567ce079d9bc56 /setuptools/tests/test_packageindex.py
parent6c31d16ce512c164e211aec0fa1d44437dfe5c61 (diff)
downloadexternal_python_setuptools-0ae5113b9bc5824a09b0e2c4e317084a4402cc0c.tar.gz
external_python_setuptools-0ae5113b9bc5824a09b0e2c4e317084a4402cc0c.tar.bz2
external_python_setuptools-0ae5113b9bc5824a09b0e2c4e317084a4402cc0c.zip
fixed #16 and #18: BadStatusLine and ValueError in package_index.urlopen
--HG-- branch : distribute extra : rebase_source : 6159cf23c0dc4effd40b525066266eefd292b96e
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r--setuptools/tests/test_packageindex.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 0231eda8..d7efe1bc 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -18,6 +18,39 @@ class TestPackageIndex(unittest.TestCase):
else:
self.assert_(isinstance(v,urllib2.HTTPError))
+ # issue 16
+ # easy_install inquant.contentmirror.plone breaks because of a typo
+ # in its home URL
+ index = setuptools.package_index.PackageIndex(
+ hosts=('www.example.com',)
+ )
+
+ url = 'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
+ try:
+ v = index.open_url(url)
+ except Exception, v:
+ self.assert_(url in str(v))
+ else:
+ self.assert_(isinstance(v, urllib2.HTTPError))
+
+ def _urlopen(*args):
+ import httplib
+ raise httplib.BadStatusLine('line')
+
+ old_urlopen = urllib2.urlopen
+ urllib2.urlopen = _urlopen
+ url = 'http://example.com'
+ try:
+ try:
+ v = index.open_url(url)
+ except Exception, v:
+ self.assert_('line' in str(v))
+ else:
+ raise AssertionError('Should have raise here!')
+ finally:
+ urllib2.urlopen = old_urlopen
+
+
def test_url_ok(self):
index = setuptools.package_index.PackageIndex(
hosts=('www.example.com',)