1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

Upgrade pylint (#2917)

depot_tools is removing pylint from its distribution so we must maintain
our own copy.
This commit is contained in:
Ryan Dahl 2019-09-11 16:47:42 -04:00 committed by GitHub
parent ad11f2ad6a
commit 82dc1b8e59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 94 additions and 86 deletions

@ -1 +1 @@
Subproject commit f8757afb7368b2f6a518ebedde728f819e7c59d0
Subproject commit 71c3e6ebb675da304783757d9f7ff9ee790b835a

View file

@ -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 = [

View file

@ -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

View file

@ -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():

View file

@ -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")

View file

@ -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:

View file

@ -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())

View file

@ -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):

View file

@ -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(

View file

@ -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)

View file

@ -1,10 +1,9 @@
#!/usr/bin/env python
# This program fails if ./tools/format.py changes any files.
import sys
import util
import sys
import subprocess
import util
def main():

View file

@ -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)

View file

@ -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"

View file

@ -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"))