aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_packageindex.py
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-20 22:55:16 +0100
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-06-20 22:55:16 +0100
commit58a658b26d1c95b31d02050dcccd648d2e4ce27b (patch)
treeb9d3e7de6f6d23b91a7afecde3491e99d8cc7069 /setuptools/tests/test_packageindex.py
parente63f3e7d864b26529d6b197e053b4084be20decf (diff)
downloadexternal_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.tar.gz
external_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.tar.bz2
external_python_setuptools-58a658b26d1c95b31d02050dcccd648d2e4ce27b.zip
Changes to support 2.x and 3.x in the same codebase.
--HG-- branch : distribute extra : rebase_source : 7d3608edee54a43789f0574d702fb839628b5071
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r--setuptools/tests/test_packageindex.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 00d44ca6..8c685c01 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -2,10 +2,11 @@
"""
# More would be better!
import sys
-import os, shutil, tempfile, unittest, urllib2
+import os, shutil, tempfile, unittest
import pkg_resources
+from setuptools.compat import urllib2, httplib, HTTPError
import setuptools.package_index
-from server import IndexServer
+from tests.server import IndexServer
class TestPackageIndex(unittest.TestCase):
@@ -14,10 +15,11 @@ class TestPackageIndex(unittest.TestCase):
url = 'http://127.0.0.1:0/nonesuch/test_package_index'
try:
v = index.open_url(url)
- except Exception, v:
+ except Exception:
+ v = sys.exc_info()[1]
self.assert_(url in str(v))
else:
- self.assert_(isinstance(v,urllib2.HTTPError))
+ self.assert_(isinstance(v, HTTPError))
# issue 16
# easy_install inquant.contentmirror.plone breaks because of a typo
@@ -29,13 +31,13 @@ class TestPackageIndex(unittest.TestCase):
url = 'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
try:
v = index.open_url(url)
- except Exception, v:
+ except Exception:
+ v = sys.exc_info()[1]
self.assert_(url in str(v))
else:
- self.assert_(isinstance(v, urllib2.HTTPError))
+ self.assert_(isinstance(v, HTTPError))
def _urlopen(*args):
- import httplib
raise httplib.BadStatusLine('line')
old_urlopen = urllib2.urlopen
@@ -44,7 +46,8 @@ class TestPackageIndex(unittest.TestCase):
try:
try:
v = index.open_url(url)
- except Exception, v:
+ except Exception:
+ v = sys.exc_info()[1]
self.assert_('line' in str(v))
else:
raise AssertionError('Should have raise here!')
@@ -55,7 +58,8 @@ class TestPackageIndex(unittest.TestCase):
url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
try:
index.open_url(url)
- except Exception, v:
+ except Exception:
+ v = sys.exc_info()[1]
self.assert_('nonnumeric port' in str(v))