Jason R. Coombs committed bee83a4

Split one test 'bad urls' into several different tests (for clarity).

Comments (0)

Files changed (1)


 """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 = ''
+    def test_bad_url_typo(self):
         # issue 16
         # easy_install inquant.contentmirror.plone breaks because of a typo
         # in its home URL
             self.assert_(isinstance(v, urllib2.HTTPError))
+    def test_bad_url_bad_status_line(self):
+        index = setuptools.package_index.PackageIndex(
+            hosts=('',)
+        )
         def _urlopen(*args):
             import httplib
             raise httplib.BadStatusLine('line')
             urllib2.urlopen = old_urlopen
+    def test_bad_url_double_scheme(self):
+        index = setuptools.package_index.PackageIndex(
+            hosts=('',)
+        )
         # issue 20
         url = 'http://'
         except Exception, v:
             self.assert_('nonnumeric port' in str(v))
+    def test_bad_url_screwy_href(self):
+        index = setuptools.package_index.PackageIndex(
+            hosts=('',)
+        )
         # issue #160
         if sys.version_info[0] == 2 and sys.version_info[1] == 7:
             index.process_index(url, page)
     def test_url_ok(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
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.