From 3abfed4e545bff958d2806e670210dbee452cad2 Mon Sep 17 00:00:00 2001 From: David Glick Date: Tue, 26 Jun 2018 18:39:31 +0200 Subject: [PATCH] Fix for python 3 --- CHANGES.rst | 3 ++- src/plone/recipe/alltests/__init__.py | 7 ++++--- src/plone/recipe/alltests/runner.py | 14 +++++++------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 1c0a7cb..1ab1c89 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,7 +10,8 @@ New: Fixes: -- *add item here* +- Fix imports when buildout was installed using pip. + [davisagli] 1.5 (2015-03-21) diff --git a/src/plone/recipe/alltests/__init__.py b/src/plone/recipe/alltests/__init__.py index e38669a..f19f8c0 100644 --- a/src/plone/recipe/alltests/__init__.py +++ b/src/plone/recipe/alltests/__init__.py @@ -1,9 +1,6 @@ import os import re -from zc.buildout import easy_install -from zc.recipe.egg import Egg - EXCLUDE_PACKAGES = set(( 'distribute', @@ -17,6 +14,8 @@ class Recipe(object): def __init__(self, buildout, name, options): + from zc.recipe.egg import Egg + self.buildout, self.options, self.name = buildout, options, name self.egg = Egg(buildout, options['recipe'], options) @@ -41,6 +40,8 @@ def __init__(self, buildout, name, options): ) def install(self): + from zc.buildout import easy_install + options = self.options location = options['location'] diff --git a/src/plone/recipe/alltests/runner.py b/src/plone/recipe/alltests/runner.py index 180a5df..8bdda8d 100644 --- a/src/plone/recipe/alltests/runner.py +++ b/src/plone/recipe/alltests/runner.py @@ -9,7 +9,7 @@ def run_test(name, script, path, arg, package): error = False - print RUNNING_TESTS % name + print(RUNNING_TESTS % name) sys.stdout.flush() value = os.system(TEST_COMMAND % dict( script=script, @@ -19,7 +19,7 @@ def run_test(name, script, path, arg, package): )) if value > 0: error = True - print FINISHED_TESTS % name + print(FINISHED_TESTS % name) sys.stdout.flush() return error @@ -73,13 +73,13 @@ def main(args): errors.append(package) if len(errors): - print "Packages with test failures:\n" + print("Packages with test failures:\n") for e in errors: - print 'Failing tests in %s' % e - print "\nTotal time elapsed: %.3f seconds" % (time.time() - start) - print "\nGrand total: %d packages, %d failures\n" % ( + print('Failing tests in %s' % e) + print("\nTotal time elapsed: %.3f seconds" % (time.time() - start)) + print("\nGrand total: %d packages, %d failures\n" % ( total_packages, len(errors) - ) + )) if len(errors) > 0: sys.exit(1)