summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/api_tests.txt8
-rw-r--r--tests/install_test.py18
-rw-r--r--tests/manual_test.py2
-rw-r--r--tests/test_distribute_setup.py6
4 files changed, 17 insertions, 17 deletions
diff --git a/tests/api_tests.txt b/tests/api_tests.txt
index 6cf6e66f..65443e09 100644
--- a/tests/api_tests.txt
+++ b/tests/api_tests.txt
@@ -39,7 +39,7 @@ Distributions have various introspectable attributes::
>>> dist.py_version == sys.version[:3]
True
- >>> print dist.platform
+ >>> print(dist.platform)
None
Including various computed attributes::
@@ -199,7 +199,7 @@ shows up once when iterating the working set:
You can ask a WorkingSet to ``find()`` a distribution matching a requirement::
>>> from pkg_resources import Requirement
- >>> print ws.find(Requirement.parse("Foo==1.0")) # no match, return None
+ >>> print(ws.find(Requirement.parse("Foo==1.0"))) # no match, return None
None
>>> ws.find(Requirement.parse("Bar==0.9")) # match, return distribution
@@ -211,7 +211,7 @@ working set triggers a ``pkg_resources.VersionConflict`` error:
>>> try:
... ws.find(Requirement.parse("Bar==1.0"))
... except VersionConflict:
- ... print 'ok'
+ ... print('ok')
ok
You can subscribe a callback function to receive notifications whenever a new
@@ -219,7 +219,7 @@ distribution is added to a working set. The callback is immediately invoked
once for each existing distribution in the working set, and then is called
again for new distributions added thereafter::
- >>> def added(dist): print "Added", dist
+ >>> def added(dist): print("Added %s" % dist)
>>> ws.subscribe(added)
Added Bar 0.9
>>> foo12 = Distribution(project_name="Foo", version="1.2", location="f12")
diff --git a/tests/install_test.py b/tests/install_test.py
index 02deb818..97b79933 100644
--- a/tests/install_test.py
+++ b/tests/install_test.py
@@ -1,19 +1,19 @@
-import urllib2
import sys
import os
+from setuptools.compat import urllib2
if os.path.exists('distribute_setup.py'):
- print 'distribute_setup.py exists in the current dir, aborting'
+ print('distribute_setup.py exists in the current dir, aborting')
sys.exit(2)
-print '**** Starting Test'
-print '\n\n'
+print('**** Starting Test')
+print('\n\n')
is_jython = sys.platform.startswith('java')
if is_jython:
import subprocess
-print 'Downloading bootstrap'
+print('Downloading bootstrap')
file = urllib2.urlopen('http://nightly.ziade.org/distribute_setup.py')
f = open('distribute_setup.py', 'w')
f.write(file.read())
@@ -27,7 +27,7 @@ else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
if res != 0:
- print '**** Test failed, please send me the output at tarek@ziade.org'
+ print('**** Test failed, please send me the output at tarek@ziade.org')
os.remove('distribute_setup.py')
sys.exit(2)
@@ -63,11 +63,11 @@ try:
else:
res = os.spawnv(os.P_WAIT, sys.executable, args)
- print '\n\n'
+ print('\n\n')
if res:
- print '**** Test is OK'
+ print('**** Test is OK')
else:
- print '**** Test failed, please send me the output at tarek@ziade.org'
+ print('**** Test failed, please send me the output at tarek@ziade.org')
finally:
if os.path.exists(script_name):
os.remove(script_name)
diff --git a/tests/manual_test.py b/tests/manual_test.py
index 0d5051f1..223567f4 100644
--- a/tests/manual_test.py
+++ b/tests/manual_test.py
@@ -9,7 +9,7 @@ import shutil
import tempfile
from distutils.command.install import INSTALL_SCHEMES
from string import Template
-from urllib2 import urlopen
+from setuptools.compat import urlopen
try:
import subprocess
diff --git a/tests/test_distribute_setup.py b/tests/test_distribute_setup.py
index 1f3da058..4f86c335 100644
--- a/tests/test_distribute_setup.py
+++ b/tests/test_distribute_setup.py
@@ -17,7 +17,7 @@ import distribute_setup
class TestSetup(unittest.TestCase):
def urlopen(self, url):
- return open(self.tarball)
+ return open(self.tarball, 'rb')
def setUp(self):
self.old_sys_path = copy.copy(sys.path)
@@ -28,7 +28,7 @@ class TestSetup(unittest.TestCase):
"--dist-dir", "%s" % self.tmpdir)
tarball = os.listdir(self.tmpdir)[0]
self.tarball = os.path.join(self.tmpdir, tarball)
- import urllib2
+ from setuptools.compat import urllib2
urllib2.urlopen = self.urlopen
def tearDown(self):
@@ -38,7 +38,7 @@ class TestSetup(unittest.TestCase):
def test_build_egg(self):
# making it an egg
- egg = _build_egg(self.tarball, self.tmpdir)
+ egg = _build_egg('Egg to be built', self.tarball, self.tmpdir)
# now trying to import it
sys.path[0] = egg