summaryrefslogtreecommitdiff
path: root/test/testpy
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2019-04-13 18:09:45 -0400
committerRefael Ackermann <refack@gmail.com>2019-04-13 20:33:06 -0400
commit1fc425522192bb66292104dc5cf6fd8e05cb2146 (patch)
tree55d5abd1b8b6692661269cd4c7f8249faf1b49a8 /test/testpy
parenta16a0fe9629325ae1dd81827c6071ca972d7449a (diff)
downloadandroid-node-v8-1fc425522192bb66292104dc5cf6fd8e05cb2146.tar.gz
android-node-v8-1fc425522192bb66292104dc5cf6fd8e05cb2146.tar.bz2
android-node-v8-1fc425522192bb66292104dc5cf6fd8e05cb2146.zip
tools: python: ignore instead of select flake8 rules
PR-URL: https://github.com/nodejs/node/pull/25614 Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Diffstat (limited to 'test/testpy')
-rw-r--r--test/testpy/__init__.py44
1 files changed, 19 insertions, 25 deletions
diff --git a/test/testpy/__init__.py b/test/testpy/__init__.py
index 332284ce4c..9c70e18d6a 100644
--- a/test/testpy/__init__.py
+++ b/test/testpy/__init__.py
@@ -27,18 +27,12 @@
import test
import os
-from os.path import join, dirname, exists, splitext
import re
-import ast
-
-try:
- reduce
-except NameError:
- from functools import reduce
+from functools import reduce
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
-
+LS_RE = re.compile(r'^test-.*\.m?js$')
class SimpleTestCase(test.TestCase):
@@ -107,15 +101,15 @@ class SimpleTestConfiguration(test.TestConfiguration):
self.additional_flags = []
def Ls(self, path):
- return [f for f in os.listdir(path) if re.match('^test-.*\.m?js$', f)]
+ return [f for f in os.listdir(path) if LS_RE.match(f)]
def ListTests(self, current_path, path, arch, mode):
- all_tests = [current_path + [t] for t in self.Ls(join(self.root))]
+ all_tests = [current_path + [t] for t in self.Ls(os.path.join(self.root))]
result = []
- for test in all_tests:
- if self.Contains(path, test):
- file_path = join(self.root, reduce(join, test[1:], ""))
- test_name = test[:-1] + [splitext(test[-1])[0]]
+ for tst in all_tests:
+ if self.Contains(path, tst):
+ file_path = os.path.join(self.root, reduce(os.path.join, tst[1:], ""))
+ test_name = tst[:-1] + [os.path.splitext(tst[-1])[0]]
result.append(SimpleTestCase(test_name, file_path, arch, mode,
self.context, self, self.additional_flags))
return result
@@ -131,8 +125,8 @@ class ParallelTestConfiguration(SimpleTestConfiguration):
def ListTests(self, current_path, path, arch, mode):
result = super(ParallelTestConfiguration, self).ListTests(
current_path, path, arch, mode)
- for test in result:
- test.parallel = True
+ for tst in result:
+ tst.parallel = True
return result
class AddonTestConfiguration(SimpleTestConfiguration):
@@ -145,20 +139,20 @@ class AddonTestConfiguration(SimpleTestConfiguration):
result = []
for subpath in os.listdir(path):
- if os.path.isdir(join(path, subpath)):
- for f in os.listdir(join(path, subpath)):
+ if os.path.isdir(os.path.join(path, subpath)):
+ for f in os.listdir(os.path.join(path, subpath)):
if SelectTest(f):
result.append([subpath, f[:-3]])
return result
def ListTests(self, current_path, path, arch, mode):
- all_tests = [current_path + t for t in self.Ls(join(self.root))]
+ all_tests = [current_path + t for t in self.Ls(os.path.join(self.root))]
result = []
- for test in all_tests:
- if self.Contains(path, test):
- file_path = join(self.root, reduce(join, test[1:], "") + ".js")
+ for tst in all_tests:
+ if self.Contains(path, tst):
+ file_path = os.path.join(self.root, reduce(os.path.join, tst[1:], "") + ".js")
result.append(
- SimpleTestCase(test, file_path, arch, mode, self.context, self, self.additional_flags))
+ SimpleTestCase(tst, file_path, arch, mode, self.context, self, self.additional_flags))
return result
class AbortTestConfiguration(SimpleTestConfiguration):
@@ -169,6 +163,6 @@ class AbortTestConfiguration(SimpleTestConfiguration):
def ListTests(self, current_path, path, arch, mode):
result = super(AbortTestConfiguration, self).ListTests(
current_path, path, arch, mode)
- for test in result:
- test.disable_core_files = True
+ for tst in result:
+ tst.disable_core_files = True
return result