summaryrefslogtreecommitdiff
path: root/setuptools/tests
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
parenta849ee957f3ba12945278f88e473eb3612faf4b9 (diff)
downloadpython-setuptools-git-9d6a6e5927ae0e67164383e419f3145fc154467e.tar.gz
Use except/as, now supported by Python 2.6
Diffstat (limited to 'setuptools/tests')
-rw-r--r--setuptools/tests/test_packageindex.py12
-rw-r--r--setuptools/tests/test_sdist.py12
2 files changed, 8 insertions, 16 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
diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py
index 943a5dee..68f83ca7 100644
--- a/setuptools/tests/test_sdist.py
+++ b/setuptools/tests/test_sdist.py
@@ -174,8 +174,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
try:
u_contents = contents.decode('UTF-8')
- except UnicodeDecodeError:
- e = sys.exc_info()[1]
+ except UnicodeDecodeError as e:
self.fail(e)
# The manifest should contain the UTF-8 filename
@@ -217,8 +216,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
try:
contents.decode('UTF-8')
- except UnicodeDecodeError:
- e = sys.exc_info()[1]
+ except UnicodeDecodeError as e:
self.fail(e)
# The manifest should contain the UTF-8 filename
@@ -258,8 +256,7 @@ class TestSdistTest:
# The manifest should be UTF-8 encoded
try:
contents.decode('UTF-8')
- except UnicodeDecodeError:
- e = sys.exc_info()[1]
+ except UnicodeDecodeError as e:
self.fail(e)
# The Latin-1 filename should have been skipped
@@ -328,8 +325,7 @@ class TestSdistTest:
with quiet():
try:
cmd.read_manifest()
- except UnicodeDecodeError:
- e = sys.exc_info()[1]
+ except UnicodeDecodeError as e:
self.fail(e)
# The Latin-1 filename should have been skipped