diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2012-04-15 13:35:52 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2012-04-15 13:35:52 -0400 |
commit | 1e64c9a55bc6e7b4560966b95c831d6ee8276295 (patch) | |
tree | f1014ee54c8bd53492b1e664469c53d730778e92 /setuptools/tests/test_packageindex.py | |
parent | 347b49d545fbd9e8b2ef50f0778507fce84d2b19 (diff) | |
download | external_python_setuptools-1e64c9a55bc6e7b4560966b95c831d6ee8276295.tar.gz external_python_setuptools-1e64c9a55bc6e7b4560966b95c831d6ee8276295.tar.bz2 external_python_setuptools-1e64c9a55bc6e7b4560966b95c831d6ee8276295.zip |
Split one test 'bad urls' into several different tests (for clarity).
--HG--
branch : distribute
extra : rebase_source : cdc7ce4fe999eb578df356ec6a2d44b65312d7d9
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r-- | setuptools/tests/test_packageindex.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 00d44ca6..3a8808f7 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -1,15 +1,15 @@ """Package Index Tests """ -# More would be better! import sys -import os, shutil, tempfile, unittest, urllib2 +import unittest +import urllib2 import pkg_resources import setuptools.package_index from server import IndexServer class TestPackageIndex(unittest.TestCase): - def test_bad_urls(self): + def test_bad_url_bad_port(self): index = setuptools.package_index.PackageIndex() url = 'http://127.0.0.1:0/nonesuch/test_package_index' try: @@ -19,6 +19,7 @@ class TestPackageIndex(unittest.TestCase): else: self.assert_(isinstance(v,urllib2.HTTPError)) + def test_bad_url_typo(self): # issue 16 # easy_install inquant.contentmirror.plone breaks because of a typo # in its home URL @@ -34,6 +35,11 @@ class TestPackageIndex(unittest.TestCase): else: self.assert_(isinstance(v, urllib2.HTTPError)) + def test_bad_url_bad_status_line(self): + index = setuptools.package_index.PackageIndex( + hosts=('www.example.com',) + ) + def _urlopen(*args): import httplib raise httplib.BadStatusLine('line') @@ -51,6 +57,11 @@ class TestPackageIndex(unittest.TestCase): finally: urllib2.urlopen = old_urlopen + def test_bad_url_double_scheme(self): + index = setuptools.package_index.PackageIndex( + hosts=('www.example.com',) + ) + # issue 20 url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk' try: @@ -58,6 +69,10 @@ class TestPackageIndex(unittest.TestCase): except Exception, v: self.assert_('nonnumeric port' in str(v)) + def test_bad_url_screwy_href(self): + index = setuptools.package_index.PackageIndex( + hosts=('www.example.com',) + ) # issue #160 if sys.version_info[0] == 2 and sys.version_info[1] == 7: @@ -67,7 +82,6 @@ class TestPackageIndex(unittest.TestCase): 'http://www.famfamfam.com/">') index.process_index(url, page) - def test_url_ok(self): index = setuptools.package_index.PackageIndex( hosts=('www.example.com',) |