From 58a658b26d1c95b31d02050dcccd648d2e4ce27b Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Mon, 20 Jun 2011 22:55:16 +0100 Subject: Changes to support 2.x and 3.x in the same codebase. --HG-- branch : distribute extra : rebase_source : 7d3608edee54a43789f0574d702fb839628b5071 --- tests/install_test.py | 18 +++++++++--------- tests/manual_test.py | 2 +- tests/test_distribute_setup.py | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'tests') 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 4151587f..37c6cf82 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 -- cgit v1.2.1