From 649a7289dc3dc93dc29d523b928bf43434a18205 Mon Sep 17 00:00:00 2001 From: cclauss Date: Tue, 11 Dec 2018 12:38:09 +0100 Subject: [PATCH] test: from functools import reduce in test/testpy/__init__.py $ __make lint-py__ # When run on Python 3 ``` PYTHONPATH=tools/pip python -m flake8 . \ --count --show-source --statistics --select=E901,E999,F821,F822,F823 \ --exclude=.git,deps,lib,src,tools/*_macros.py,tools/gyp,tools/inspector_protocol,tools/jinja2,tools/markupsafe,tools/pip ./test/testpy/__init__.py:119:37: F821 undefined name 'reduce' file_path = join(self.root, reduce(join, test[1:], "")) ^ ./test/testpy/__init__.py:161:37: F821 undefined name 'reduce' file_path = join(self.root, reduce(join, test[1:], "") + ".js") ^ 2 F821 undefined name 'reduce' 2 make: *** [lint-py] Error 1 ``` PR-URL: https://github.com/nodejs/node/pull/24954 Reviewed-By: Richard Lau Reviewed-By: Rich Trott Reviewed-By: Ruben Bridgewater Reviewed-By: Anna Henningsen --- test/testpy/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py index 7ba9674d7d6e57..7d23c47214eedb 100644 --- a/test/testpy/__init__.py +++ b/test/testpy/__init__.py @@ -31,6 +31,11 @@ import re import ast +try: + reduce +except NameError: + from functools import reduce + FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") FILES_PATTERN = re.compile(r"//\s+Files:(.*)")