From 7fb390c574b0ace3c237335ff67e66d7244aaac9 Mon Sep 17 00:00:00 2001 From: dieter Date: Wed, 11 May 2022 10:56:37 +0200 Subject: [PATCH] work around Python 2 problem --- src/zope/testrunner/runner.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/zope/testrunner/runner.py b/src/zope/testrunner/runner.py index 86582ba..b24c051 100644 --- a/src/zope/testrunner/runner.py +++ b/src/zope/testrunner/runner.py @@ -1093,6 +1093,8 @@ def layer_sort_key(layer): # Note: we cannot reuse gather_layers() here because it uses a # different traversal order. + binding = {} # hack to avoid recursion -- for PY2 + def _gather(layer): seen.add(layer) # We make the simplifying assumption that the order of initialization @@ -1102,14 +1104,15 @@ def _gather(layer): # zope.testrunner, so let's use that. for base in layer.__bases__[::-1]: if base is not object and base not in seen: - _gather(base) + binding["_gather"](base) key.append(layer) + binding["_gather"] = _gather _gather(layer) try: return tuple(name_from_layer(ly) for ly in key if ly != UnitTests) finally: - del _gather # break reference cycle + binding.clear() # break reference cycle def order_by_bases(layers):