diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-09-11 16:47:42 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-11 16:47:42 -0400 |
commit | 82dc1b8e59891a7ca0f1a5e67a3db952b918561c (patch) | |
tree | e958c5d7bff81a4f218ad81b5e7b56451213d60a | |
parent | ad11f2ad6aae758e67734d60f068285fb5e10655 (diff) |
Upgrade pylint (#2917)
depot_tools is removing pylint from its distribution so we must maintain
our own copy.
m--------- | third_party | 0 | ||||
-rwxr-xr-x | tools/benchmark.py | 10 | ||||
-rwxr-xr-x | tools/benchmark_test.py | 2 | ||||
-rwxr-xr-x | tools/complex_permissions_test.py | 60 | ||||
-rwxr-xr-x | tools/format.py | 2 | ||||
-rwxr-xr-x | tools/http_benchmark.py | 2 | ||||
-rwxr-xr-x | tools/lint.py | 8 | ||||
-rwxr-xr-x | tools/permission_prompt_test.py | 30 | ||||
-rwxr-xr-x | tools/setup.py | 8 | ||||
-rw-r--r-- | tools/setup_test.py | 20 | ||||
-rwxr-xr-x | tools/test_format.py | 3 | ||||
-rw-r--r-- | tools/third_party.py | 11 | ||||
-rwxr-xr-x | tools/throughput_benchmark.py | 2 | ||||
-rwxr-xr-x | tools/util_test.py | 20 |
14 files changed, 93 insertions, 85 deletions
diff --git a/third_party b/third_party -Subproject f8757afb7368b2f6a518ebedde728f819e7c59d +Subproject 71c3e6ebb675da304783757d9f7ff9ee790b835 diff --git a/tools/benchmark.py b/tools/benchmark.py index d6c45259d..3c9875d6a 100755 --- a/tools/benchmark.py +++ b/tools/benchmark.py @@ -11,14 +11,14 @@ import sys import json import time import shutil +import tempfile +import subprocess from util import find_exts, root_path, run, run_output from util import build_path, executable_suffix -import tempfile -import http_server -import throughput_benchmark -from http_benchmark import http_benchmark import prebuilt -import subprocess +from http_benchmark import http_benchmark +import throughput_benchmark +import http_server # The list of the tuples of the benchmark name and arguments exec_time_benchmarks = [ diff --git a/tools/benchmark_test.py b/tools/benchmark_test.py index d84451494..28d812647 100755 --- a/tools/benchmark_test.py +++ b/tools/benchmark_test.py @@ -2,8 +2,8 @@ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import sys import os -import benchmark import unittest +import benchmark from test_util import DenoTestCase, run_tests diff --git a/tools/complex_permissions_test.py b/tools/complex_permissions_test.py index 00cda6069..32385649b 100755 --- a/tools/complex_permissions_test.py +++ b/tools/complex_permissions_test.py @@ -31,8 +31,8 @@ class BaseReadWritePermissionsTest(object): ["--allow-" + self.test_type + "=" + root_path], [self.test_type, "package.json", "tests/subdir/config.json"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_outside_test_dir(self): code, _stdout, stderr = self._run_deno([ @@ -40,7 +40,7 @@ class BaseReadWritePermissionsTest(object): root_path, "tests") ], [self.test_type, "package.json"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_inside_test_dir(self): @@ -49,8 +49,8 @@ class BaseReadWritePermissionsTest(object): root_path, "tests") ], [self.test_type, "tests/subdir/config.json"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_outside_test_and_js_dir(self): code, _stdout, stderr = self._run_deno([ @@ -58,7 +58,7 @@ class BaseReadWritePermissionsTest(object): root_path, "tests") + "," + os.path.join(root_path, "js") ], [self.test_type, "package.json"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_inside_test_and_js_dir(self): @@ -67,8 +67,8 @@ class BaseReadWritePermissionsTest(object): root_path, "tests") + "," + os.path.join(root_path, "js") ], [self.test_type, "js/dir_test.ts", "tests/subdir/config.json"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_relative(self): # Save and restore curdir @@ -78,8 +78,8 @@ class BaseReadWritePermissionsTest(object): ["--allow-" + self.test_type + "=" + "./tests"], [self.test_type, "tests/subdir/config.json"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr os.chdir(saved_curdir) def test_no_prefix(self): @@ -90,8 +90,8 @@ class BaseReadWritePermissionsTest(object): ["--allow-" + self.test_type + "=" + "tests"], [self.test_type, "tests/subdir/config.json"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr os.chdir(saved_curdir) @@ -113,15 +113,15 @@ class TestNetFetchPermissions(BaseComplexPermissionTest): ["--allow-net=localhost:4545"], [self.test_type, "http://localhost:4545"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_allow_deno_land(self): code, _stdout, stderr = self._run_deno( ["--allow-net=deno.land"], [self.test_type, "http://localhost:4545"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost_4545_fail(self): @@ -129,7 +129,7 @@ class TestNetFetchPermissions(BaseComplexPermissionTest): ["--allow-net=localhost:4545"], [self.test_type, "http://localhost:4546"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost(self): @@ -138,8 +138,8 @@ class TestNetFetchPermissions(BaseComplexPermissionTest): "http://localhost:4547" ]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr class TestNetDialPermissions(BaseComplexPermissionTest): @@ -149,21 +149,21 @@ class TestNetDialPermissions(BaseComplexPermissionTest): code, _stdout, stderr = self._run_deno( ["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4545"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_allow_deno_land(self): code, _stdout, stderr = self._run_deno( ["--allow-net=deno.land"], [self.test_type, "127.0.0.1:4545"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost_ip_4545_fail(self): code, _stdout, stderr = self._run_deno( ["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4546"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost_ip(self): @@ -172,8 +172,8 @@ class TestNetDialPermissions(BaseComplexPermissionTest): "127.0.0.1:4547" ]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr class TestNetListenPermissions(BaseComplexPermissionTest): @@ -183,21 +183,21 @@ class TestNetListenPermissions(BaseComplexPermissionTest): code, _stdout, stderr = self._run_deno( ["--allow-net=localhost:4555"], [self.test_type, "localhost:4555"]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_allow_deno_land(self): code, _stdout, stderr = self._run_deno( ["--allow-net=deno.land"], [self.test_type, "localhost:4545"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost_4555_fail(self): code, _stdout, stderr = self._run_deno( ["--allow-net=localhost:4555"], [self.test_type, "localhost:4556"]) assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert PERMISSION_DENIED_PATTERN in stderr def test_allow_localhost(self): @@ -206,8 +206,8 @@ class TestNetListenPermissions(BaseComplexPermissionTest): "localhost:4557" ]) assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def complex_permissions_tests(): diff --git a/tools/format.py b/tools/format.py index aa2208b01..95aa2d2e9 100755 --- a/tools/format.py +++ b/tools/format.py @@ -3,10 +3,10 @@ from glob import glob import os import sys +import argparse from third_party import google_env, python_env from third_party import clang_format_path, third_party_path from util import root_path, run, find_exts, platform -import argparse parser = argparse.ArgumentParser() parser.add_argument("--js", help="only run prettier", action="store_true") diff --git a/tools/http_benchmark.py b/tools/http_benchmark.py index 30e5ba675..5fac44e78 100755 --- a/tools/http_benchmark.py +++ b/tools/http_benchmark.py @@ -2,9 +2,9 @@ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import os import sys -import util import time import subprocess +import util # Some of the benchmarks in this file have been renamed. In case the history # somehow gets messed up: diff --git a/tools/lint.py b/tools/lint.py index fb400a8e9..92e58dbc2 100755 --- a/tools/lint.py +++ b/tools/lint.py @@ -5,6 +5,7 @@ import os import sys from util import enable_ansi_colors, find_exts, root_path, run +from third_party import python_env enable_ansi_colors() @@ -24,5 +25,8 @@ run([ "./core/**/*.{ts,js}", "./tests/**/*.{ts,js}" ]) -run([sys.executable, "third_party/depot_tools/pylint.py"] + - find_exts(["tools", "build_extra"], [".py"], skip=["tools/clang"])) +run([ + sys.executable, "third_party/python_packages/pylint", + "--rcfile=third_party/depot_tools/pylintrc" +] + find_exts(["tools", "build_extra"], [".py"], skip=["tools/clang"]), + env=python_env()) diff --git a/tools/permission_prompt_test.py b/tools/permission_prompt_test.py index 68069cb0e..e5516e450 100755 --- a/tools/permission_prompt_test.py +++ b/tools/permission_prompt_test.py @@ -27,9 +27,9 @@ class BasePromptTest(object): code, stdout, stderr = self._run_deno( ["--allow-" + test_type], ["needs" + test_type.capitalize()], b'') assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert FIRST_CHECK_FAILED_PATTERN not in stdout + assert PERMISSION_DENIED_PATTERN not in stderr def test_yes_yes(self): test_type = self.test_type @@ -37,8 +37,8 @@ class BasePromptTest(object): [], ["needs" + test_type.capitalize()], b'y\ny\n') assert code == 0 assert PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert FIRST_CHECK_FAILED_PATTERN not in stdout + assert PERMISSION_DENIED_PATTERN not in stderr def test_yes_no(self): test_type = self.test_type @@ -46,7 +46,7 @@ class BasePromptTest(object): [], ["needs" + test_type.capitalize()], b'y\nn\n') assert code == 1 assert PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout + assert FIRST_CHECK_FAILED_PATTERN not in stdout assert PERMISSION_DENIED_PATTERN in stderr def test_no_no(self): @@ -66,7 +66,7 @@ class BasePromptTest(object): assert PROMPT_PATTERN in stderr assert FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert PERMISSION_DENIED_PATTERN not in stderr def test_allow(self): test_type = self.test_type @@ -74,8 +74,8 @@ class BasePromptTest(object): [], ["needs" + test_type.capitalize()], b'a\n') assert code == 0 assert PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert FIRST_CHECK_FAILED_PATTERN not in stdout + assert PERMISSION_DENIED_PATTERN not in stderr def test_deny(self): test_type = self.test_type @@ -92,8 +92,8 @@ class BasePromptTest(object): [], ["needs" + test_type.capitalize()], b'e\na\n') assert code == 0 assert PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert FIRST_CHECK_FAILED_PATTERN not in stdout + assert PERMISSION_DENIED_PATTERN not in stderr assert b'Unrecognized option' in stderr def test_no_prompt(self): @@ -101,7 +101,7 @@ class BasePromptTest(object): code, stdout, stderr = self._run_deno( ["--no-prompt"], ["needs" + test_type.capitalize()], b'') assert code == 1 - assert not PROMPT_PATTERN in stderr + assert PROMPT_PATTERN not in stderr assert FIRST_CHECK_FAILED_PATTERN in stdout assert PERMISSION_DENIED_PATTERN in stderr @@ -111,9 +111,9 @@ class BasePromptTest(object): ["--no-prompt", "--allow-" + test_type], ["needs" + test_type.capitalize()], b'') assert code == 0 - assert not PROMPT_PATTERN in stderr - assert not FIRST_CHECK_FAILED_PATTERN in stdout - assert not PERMISSION_DENIED_PATTERN in stderr + assert PROMPT_PATTERN not in stderr + assert FIRST_CHECK_FAILED_PATTERN not in stdout + assert PERMISSION_DENIED_PATTERN not in stderr class ReadPromptTest(DenoTestCase, BasePromptTest): diff --git a/tools/setup.py b/tools/setup.py index ddb9dc3e8..47281ff8b 100755 --- a/tools/setup.py +++ b/tools/setup.py @@ -1,14 +1,14 @@ #!/usr/bin/env python # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. -import third_party -from util import (build_mode, build_path, enable_ansi_colors, root_path, run, - shell_quote) import os import re import sys from distutils.spawn import find_executable -import prebuilt import argparse +import prebuilt +import third_party +from util import (build_mode, build_path, enable_ansi_colors, root_path, run, + shell_quote) parser = argparse.ArgumentParser() parser.add_argument( diff --git a/tools/setup_test.py b/tools/setup_test.py index 69e1ea349..275c53e30 100644 --- a/tools/setup_test.py +++ b/tools/setup_test.py @@ -1,27 +1,25 @@ # Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import os import sys - -from setup import gn_string, read_gn_args, write_gn_args from shutil import rmtree from tempfile import mktemp - +from setup import gn_string, read_gn_args, write_gn_args from test_util import DenoTestCase, run_tests class TestSetup(DenoTestCase): def test_gn_string(self): - assert '"abc"' == gn_string('abc') - assert '"foo\\$bar\\"baz"' == gn_string('foo$bar"baz') - assert '"do\\not\\escape"' == gn_string('do\\not\\escape') - assert '"so\\\\\\very\\\\\\"fun\\"' == gn_string('so\\\\very\\"fun\\') + assert gn_string('abc') == '"abc"' + assert gn_string('foo$bar"baz') == '"foo\\$bar\\"baz"' + assert gn_string('do\\not\\escape') == '"do\\not\\escape"' + assert gn_string('so\\\\very\\"fun\\') == '"so\\\\\\very\\\\\\"fun\\"' def test_read_gn_args(self): # Args file doesn't exist. (args, hand_edited) = read_gn_args("/baddir/hopefully/nonexistent/args.gn") assert args is None - assert hand_edited == False + assert not hand_edited # Handwritten empty args file. filename = mktemp() @@ -30,7 +28,7 @@ class TestSetup(DenoTestCase): (args, hand_edited) = read_gn_args(filename) os.remove(filename) assert args == [] - assert hand_edited == True + assert hand_edited # Handwritten non-empty args file. expect_args = ['some_number=2', 'another_string="ran/dom#yes"'] @@ -40,7 +38,7 @@ class TestSetup(DenoTestCase): (args, hand_edited) = read_gn_args(filename) os.remove(filename) assert args == expect_args - assert hand_edited == True + assert hand_edited def test_write_gn_args(self): # Build a nonexistent path; write_gn_args() should call mkdir as needed. @@ -57,7 +55,7 @@ class TestSetup(DenoTestCase): # Validate that the right contents were written. (check_args, hand_edited) = read_gn_args(filename) assert check_args == args - assert hand_edited == False + assert not hand_edited # Clean up. rmtree(d) diff --git a/tools/test_format.py b/tools/test_format.py index 00374d130..c45e0861e 100755 --- a/tools/test_format.py +++ b/tools/test_format.py @@ -2,9 +2,8 @@ # This program fails if ./tools/format.py changes any files. import sys -import util -import sys import subprocess +import util def main(): diff --git a/tools/third_party.py b/tools/third_party.py index 2333c3147..7ee8f22e4 100644 --- a/tools/third_party.py +++ b/tools/third_party.py @@ -3,11 +3,11 @@ # This script contains helper functions to work with the third_party subrepo. import os +from os import path import site import sys -from os import path -from util import add_env_path, find_exts, make_env, rmtree, root_path, run from tempfile import mkdtemp +from util import add_env_path, find_exts, make_env, rmtree, root_path, run # Helper function that returns the full path to a subpath of the repo root. @@ -129,6 +129,13 @@ def run_pip(): ], cwd=third_party_path, merge_env=pip_env) + + run([ + sys.executable, "-m", "pip", "install", "--upgrade", "--target", + python_packages_path, "pylint==1.5.6" + ], + cwd=third_party_path, + merge_env=pip_env) # Remove the temporary pip installation. rmtree(temp_python_home) diff --git a/tools/throughput_benchmark.py b/tools/throughput_benchmark.py index 9343d9613..725b545ba 100755 --- a/tools/throughput_benchmark.py +++ b/tools/throughput_benchmark.py @@ -8,9 +8,9 @@ import os import sys -import util import time import subprocess +import util MB = 1024 * 1024 ADDR = "127.0.0.1:4544" diff --git a/tools/util_test.py b/tools/util_test.py index 4a545ff1c..b8098e463 100755 --- a/tools/util_test.py +++ b/tools/util_test.py @@ -8,18 +8,18 @@ from util import (parse_exit_code, shell_quote_win, parse_wrk_output, class TestUtil(DenoTestCase): def test_parse_exit_code(self): - assert 54 == parse_exit_code('hello_error54_world') - assert 1 == parse_exit_code('hello_error_world') - assert 0 == parse_exit_code('hello_world') + assert parse_exit_code('hello_error54_world') == 54 + assert parse_exit_code('hello_error_world') == 1 + assert parse_exit_code('hello_world') == 0 def test_shell_quote_win(self): - assert 'simple' == shell_quote_win('simple') - assert 'roof/\\isoprojection' == shell_quote_win( - 'roof/\\isoprojection') - assert '"with space"' == shell_quote_win('with space') - assert '"embedded""quote"' == shell_quote_win('embedded"quote') - assert '"a""b""""c\\d\\\\""e\\\\\\\\"' == shell_quote_win( - 'a"b""c\\d\\"e\\\\') + assert shell_quote_win('simple') == 'simple' + assert shell_quote_win( + 'roof/\\isoprojection') == 'roof/\\isoprojection' + assert shell_quote_win('with space') == '"with space"' + assert shell_quote_win('embedded"quote') == '"embedded""quote"' + assert shell_quote_win( + 'a"b""c\\d\\"e\\\\') == '"a""b""""c\\d\\\\""e\\\\\\\\"' def test_parse_wrk_output(self): f = open(os.path.join(root_path, "tools/testdata/wrk1.txt")) |