summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_packageindex.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2015-01-04 11:35:16 -0500
committerJason R. Coombs <jaraco@jaraco.com>2015-01-04 11:35:16 -0500
commit9d6a6e5927ae0e67164383e419f3145fc154467e (patch)
tree8872d8b6de4c8706a5178dcb3dab2c9803216e59 /setuptools/tests/test_packageindex.py
parenta849ee957f3ba12945278f88e473eb3612faf4b9 (diff)
downloadpython-setuptools-git-9d6a6e5927ae0e67164383e419f3145fc154467e.tar.gz
Use except/as, now supported by Python 2.6
Diffstat (limited to 'setuptools/tests/test_packageindex.py')
-rw-r--r--setuptools/tests/test_packageindex.py12
1 files changed, 4 insertions, 8 deletions
diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py
index 3e9d1d84..dcd90d6f 100644
--- a/setuptools/tests/test_packageindex.py
+++ b/setuptools/tests/test_packageindex.py
@@ -15,8 +15,7 @@ class TestPackageIndex:
url = 'http://127.0.0.1:0/nonesuch/test_package_index'
try:
v = index.open_url(url)
- except Exception:
- v = sys.exc_info()[1]
+ except Exception as v:
assert url in str(v)
else:
assert isinstance(v, HTTPError)
@@ -32,8 +31,7 @@ class TestPackageIndex:
url = 'url:%20https://svn.plone.org/svn/collective/inquant.contentmirror.plone/trunk'
try:
v = index.open_url(url)
- except Exception:
- v = sys.exc_info()[1]
+ except Exception as v:
assert url in str(v)
else:
assert isinstance(v, HTTPError)
@@ -50,8 +48,7 @@ class TestPackageIndex:
url = 'http://example.com'
try:
v = index.open_url(url)
- except Exception:
- v = sys.exc_info()[1]
+ except Exception as v:
assert 'line' in str(v)
else:
raise AssertionError('Should have raise here!')
@@ -68,8 +65,7 @@ class TestPackageIndex:
url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
try:
index.open_url(url)
- except distutils.errors.DistutilsError:
- error = sys.exc_info()[1]
+ except distutils.errors.DistutilsError as error:
msg = unicode(error)
assert 'nonnumeric port' in msg or 'getaddrinfo failed' in msg or 'Name or service not known' in msg
return