aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_resources.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_resources.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_resources.py')
-rw-r--r--setuptools/tests/test_resources.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/setuptools/tests/test_resources.py b/setuptools/tests/test_resources.py
index c10ca210..57536221 100644
--- a/setuptools/tests/test_resources.py
+++ b/setuptools/tests/test_resources.py
@@ -3,7 +3,8 @@
# NOTE: the shebang and encoding lines are for ScriptHeaderTests; do not remove
from unittest import TestCase, makeSuite; from pkg_resources import *
from setuptools.command.easy_install import get_script_header, is_sh
-import os, pkg_resources, sys, StringIO, tempfile, shutil
+from setuptools.compat import StringIO, iteritems
+import os, pkg_resources, sys, tempfile, shutil
try: frozenset
except NameError:
from sets import ImmutableSet as frozenset
@@ -139,7 +140,7 @@ class DistroTests(TestCase):
for i in range(3):
targets = list(ws.resolve(parse_requirements("Foo"), ad))
self.assertEqual(targets, [Foo])
- map(ws.add,targets)
+ list(map(ws.add,targets))
self.assertRaises(VersionConflict, ws.resolve,
parse_requirements("Foo==0.9"), ad)
ws = WorkingSet([]) # reset
@@ -262,7 +263,7 @@ class EntryPointTests(TestCase):
def checkSubMap(self, m):
self.assertEqual(len(m), len(self.submap_expect))
- for key, ep in self.submap_expect.iteritems():
+ for key, ep in iteritems(self.submap_expect):
self.assertEqual(repr(m.get(key)), repr(ep))
submap_expect = dict(
@@ -286,10 +287,10 @@ class EntryPointTests(TestCase):
def testParseMap(self):
m = EntryPoint.parse_map({'xyz':self.submap_str})
self.checkSubMap(m['xyz'])
- self.assertEqual(m.keys(),['xyz'])
+ self.assertEqual(list(m.keys()),['xyz'])
m = EntryPoint.parse_map("[xyz]\n"+self.submap_str)
self.checkSubMap(m['xyz'])
- self.assertEqual(m.keys(),['xyz'])
+ self.assertEqual(list(m.keys()),['xyz'])
self.assertRaises(ValueError, EntryPoint.parse_map, ["[xyz]", "[xyz]"])
self.assertRaises(ValueError, EntryPoint.parse_map, self.submap_str)
@@ -549,12 +550,12 @@ class ScriptHeaderTests(TestCase):
# Ensure we generate what is basically a broken shebang line
# when there's options, with a warning emitted
- sys.stdout = sys.stderr = StringIO.StringIO()
+ sys.stdout = sys.stderr = StringIO()
self.assertEqual(get_script_header('#!/usr/bin/python -x',
executable=exe),
'#!%s -x\n' % exe)
self.assert_('Unable to adapt shebang line' in sys.stdout.getvalue())
- sys.stdout = sys.stderr = StringIO.StringIO()
+ sys.stdout = sys.stderr = StringIO()
self.assertEqual(get_script_header('#!/usr/bin/python',
executable=self.non_ascii_exe),
'#!%s -x\n' % self.non_ascii_exe)
@@ -606,7 +607,7 @@ class NamespaceTests(TestCase):
self.assertTrue("pkg1" in pkg_resources._namespace_packages.keys())
try:
import pkg1.pkg2
- except ImportError, e:
+ except ImportError:
self.fail("Distribute tried to import the parent namespace package")
# check the _namespace_packages dict
self.assertTrue("pkg1.pkg2" in pkg_resources._namespace_packages.keys())