mirror of
https://github.com/denoland/deno.git
synced 2025-01-03 12:58:54 -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:
parent
ad11f2ad6a
commit
82dc1b8e59
14 changed files with 94 additions and 86 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit f8757afb7368b2f6a518ebedde728f819e7c59d0
|
Subproject commit 71c3e6ebb675da304783757d9f7ff9ee790b835a
|
|
@ -11,14 +11,14 @@ import sys
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import shutil
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import subprocess
|
||||||
from util import find_exts, root_path, run, run_output
|
from util import find_exts, root_path, run, run_output
|
||||||
from util import build_path, executable_suffix
|
from util import build_path, executable_suffix
|
||||||
import tempfile
|
|
||||||
import http_server
|
|
||||||
import throughput_benchmark
|
|
||||||
from http_benchmark import http_benchmark
|
|
||||||
import prebuilt
|
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
|
# The list of the tuples of the benchmark name and arguments
|
||||||
exec_time_benchmarks = [
|
exec_time_benchmarks = [
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import benchmark
|
|
||||||
import unittest
|
import unittest
|
||||||
|
import benchmark
|
||||||
from test_util import DenoTestCase, run_tests
|
from test_util import DenoTestCase, run_tests
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ class BaseReadWritePermissionsTest(object):
|
||||||
["--allow-" + self.test_type + "=" + root_path],
|
["--allow-" + self.test_type + "=" + root_path],
|
||||||
[self.test_type, "package.json", "tests/subdir/config.json"])
|
[self.test_type, "package.json", "tests/subdir/config.json"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_outside_test_dir(self):
|
def test_outside_test_dir(self):
|
||||||
code, _stdout, stderr = self._run_deno([
|
code, _stdout, stderr = self._run_deno([
|
||||||
|
@ -40,7 +40,7 @@ class BaseReadWritePermissionsTest(object):
|
||||||
root_path, "tests")
|
root_path, "tests")
|
||||||
], [self.test_type, "package.json"])
|
], [self.test_type, "package.json"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_inside_test_dir(self):
|
def test_inside_test_dir(self):
|
||||||
|
@ -49,8 +49,8 @@ class BaseReadWritePermissionsTest(object):
|
||||||
root_path, "tests")
|
root_path, "tests")
|
||||||
], [self.test_type, "tests/subdir/config.json"])
|
], [self.test_type, "tests/subdir/config.json"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_outside_test_and_js_dir(self):
|
def test_outside_test_and_js_dir(self):
|
||||||
code, _stdout, stderr = self._run_deno([
|
code, _stdout, stderr = self._run_deno([
|
||||||
|
@ -58,7 +58,7 @@ class BaseReadWritePermissionsTest(object):
|
||||||
root_path, "tests") + "," + os.path.join(root_path, "js")
|
root_path, "tests") + "," + os.path.join(root_path, "js")
|
||||||
], [self.test_type, "package.json"])
|
], [self.test_type, "package.json"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_inside_test_and_js_dir(self):
|
def test_inside_test_and_js_dir(self):
|
||||||
|
@ -67,8 +67,8 @@ class BaseReadWritePermissionsTest(object):
|
||||||
root_path, "tests") + "," + os.path.join(root_path, "js")
|
root_path, "tests") + "," + os.path.join(root_path, "js")
|
||||||
], [self.test_type, "js/dir_test.ts", "tests/subdir/config.json"])
|
], [self.test_type, "js/dir_test.ts", "tests/subdir/config.json"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_relative(self):
|
def test_relative(self):
|
||||||
# Save and restore curdir
|
# Save and restore curdir
|
||||||
|
@ -78,8 +78,8 @@ class BaseReadWritePermissionsTest(object):
|
||||||
["--allow-" + self.test_type + "=" + "./tests"],
|
["--allow-" + self.test_type + "=" + "./tests"],
|
||||||
[self.test_type, "tests/subdir/config.json"])
|
[self.test_type, "tests/subdir/config.json"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
os.chdir(saved_curdir)
|
os.chdir(saved_curdir)
|
||||||
|
|
||||||
def test_no_prefix(self):
|
def test_no_prefix(self):
|
||||||
|
@ -90,8 +90,8 @@ class BaseReadWritePermissionsTest(object):
|
||||||
["--allow-" + self.test_type + "=" + "tests"],
|
["--allow-" + self.test_type + "=" + "tests"],
|
||||||
[self.test_type, "tests/subdir/config.json"])
|
[self.test_type, "tests/subdir/config.json"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
os.chdir(saved_curdir)
|
os.chdir(saved_curdir)
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,15 +113,15 @@ class TestNetFetchPermissions(BaseComplexPermissionTest):
|
||||||
["--allow-net=localhost:4545"],
|
["--allow-net=localhost:4545"],
|
||||||
[self.test_type, "http://localhost:4545"])
|
[self.test_type, "http://localhost:4545"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_allow_deno_land(self):
|
def test_allow_deno_land(self):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=deno.land"],
|
["--allow-net=deno.land"],
|
||||||
[self.test_type, "http://localhost:4545"])
|
[self.test_type, "http://localhost:4545"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost_4545_fail(self):
|
def test_allow_localhost_4545_fail(self):
|
||||||
|
@ -129,7 +129,7 @@ class TestNetFetchPermissions(BaseComplexPermissionTest):
|
||||||
["--allow-net=localhost:4545"],
|
["--allow-net=localhost:4545"],
|
||||||
[self.test_type, "http://localhost:4546"])
|
[self.test_type, "http://localhost:4546"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost(self):
|
def test_allow_localhost(self):
|
||||||
|
@ -138,8 +138,8 @@ class TestNetFetchPermissions(BaseComplexPermissionTest):
|
||||||
"http://localhost:4547"
|
"http://localhost:4547"
|
||||||
])
|
])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
|
|
||||||
class TestNetDialPermissions(BaseComplexPermissionTest):
|
class TestNetDialPermissions(BaseComplexPermissionTest):
|
||||||
|
@ -149,21 +149,21 @@ class TestNetDialPermissions(BaseComplexPermissionTest):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4545"])
|
["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4545"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_allow_deno_land(self):
|
def test_allow_deno_land(self):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=deno.land"], [self.test_type, "127.0.0.1:4545"])
|
["--allow-net=deno.land"], [self.test_type, "127.0.0.1:4545"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost_ip_4545_fail(self):
|
def test_allow_localhost_ip_4545_fail(self):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4546"])
|
["--allow-net=127.0.0.1:4545"], [self.test_type, "127.0.0.1:4546"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost_ip(self):
|
def test_allow_localhost_ip(self):
|
||||||
|
@ -172,8 +172,8 @@ class TestNetDialPermissions(BaseComplexPermissionTest):
|
||||||
"127.0.0.1:4547"
|
"127.0.0.1:4547"
|
||||||
])
|
])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
|
|
||||||
class TestNetListenPermissions(BaseComplexPermissionTest):
|
class TestNetListenPermissions(BaseComplexPermissionTest):
|
||||||
|
@ -183,21 +183,21 @@ class TestNetListenPermissions(BaseComplexPermissionTest):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=localhost:4555"], [self.test_type, "localhost:4555"])
|
["--allow-net=localhost:4555"], [self.test_type, "localhost:4555"])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_allow_deno_land(self):
|
def test_allow_deno_land(self):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=deno.land"], [self.test_type, "localhost:4545"])
|
["--allow-net=deno.land"], [self.test_type, "localhost:4545"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost_4555_fail(self):
|
def test_allow_localhost_4555_fail(self):
|
||||||
code, _stdout, stderr = self._run_deno(
|
code, _stdout, stderr = self._run_deno(
|
||||||
["--allow-net=localhost:4555"], [self.test_type, "localhost:4556"])
|
["--allow-net=localhost:4555"], [self.test_type, "localhost:4556"])
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_allow_localhost(self):
|
def test_allow_localhost(self):
|
||||||
|
@ -206,8 +206,8 @@ class TestNetListenPermissions(BaseComplexPermissionTest):
|
||||||
"localhost:4557"
|
"localhost:4557"
|
||||||
])
|
])
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
|
|
||||||
def complex_permissions_tests():
|
def complex_permissions_tests():
|
||||||
|
|
|
@ -3,10 +3,10 @@
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import argparse
|
||||||
from third_party import google_env, python_env
|
from third_party import google_env, python_env
|
||||||
from third_party import clang_format_path, third_party_path
|
from third_party import clang_format_path, third_party_path
|
||||||
from util import root_path, run, find_exts, platform
|
from util import root_path, run, find_exts, platform
|
||||||
import argparse
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--js", help="only run prettier", action="store_true")
|
parser.add_argument("--js", help="only run prettier", action="store_true")
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import util
|
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import util
|
||||||
|
|
||||||
# Some of the benchmarks in this file have been renamed. In case the history
|
# Some of the benchmarks in this file have been renamed. In case the history
|
||||||
# somehow gets messed up:
|
# somehow gets messed up:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from util import enable_ansi_colors, find_exts, root_path, run
|
from util import enable_ansi_colors, find_exts, root_path, run
|
||||||
|
from third_party import python_env
|
||||||
|
|
||||||
enable_ansi_colors()
|
enable_ansi_colors()
|
||||||
|
|
||||||
|
@ -24,5 +25,8 @@ run([
|
||||||
"./core/**/*.{ts,js}", "./tests/**/*.{ts,js}"
|
"./core/**/*.{ts,js}", "./tests/**/*.{ts,js}"
|
||||||
])
|
])
|
||||||
|
|
||||||
run([sys.executable, "third_party/depot_tools/pylint.py"] +
|
run([
|
||||||
find_exts(["tools", "build_extra"], [".py"], skip=["tools/clang"]))
|
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())
|
||||||
|
|
|
@ -27,9 +27,9 @@ class BasePromptTest(object):
|
||||||
code, stdout, stderr = self._run_deno(
|
code, stdout, stderr = self._run_deno(
|
||||||
["--allow-" + test_type], ["needs" + test_type.capitalize()], b'')
|
["--allow-" + test_type], ["needs" + test_type.capitalize()], b'')
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN not in stdout
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_yes_yes(self):
|
def test_yes_yes(self):
|
||||||
test_type = self.test_type
|
test_type = self.test_type
|
||||||
|
@ -37,8 +37,8 @@ class BasePromptTest(object):
|
||||||
[], ["needs" + test_type.capitalize()], b'y\ny\n')
|
[], ["needs" + test_type.capitalize()], b'y\ny\n')
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN in stderr
|
||||||
assert not FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN not in stdout
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_yes_no(self):
|
def test_yes_no(self):
|
||||||
test_type = self.test_type
|
test_type = self.test_type
|
||||||
|
@ -46,7 +46,7 @@ class BasePromptTest(object):
|
||||||
[], ["needs" + test_type.capitalize()], b'y\nn\n')
|
[], ["needs" + test_type.capitalize()], b'y\nn\n')
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert PROMPT_PATTERN in stderr
|
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
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
def test_no_no(self):
|
def test_no_no(self):
|
||||||
|
@ -66,7 +66,7 @@ class BasePromptTest(object):
|
||||||
|
|
||||||
assert PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN in stderr
|
||||||
assert FIRST_CHECK_FAILED_PATTERN in stdout
|
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):
|
def test_allow(self):
|
||||||
test_type = self.test_type
|
test_type = self.test_type
|
||||||
|
@ -74,8 +74,8 @@ class BasePromptTest(object):
|
||||||
[], ["needs" + test_type.capitalize()], b'a\n')
|
[], ["needs" + test_type.capitalize()], b'a\n')
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN in stderr
|
||||||
assert not FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN not in stdout
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
def test_deny(self):
|
def test_deny(self):
|
||||||
test_type = self.test_type
|
test_type = self.test_type
|
||||||
|
@ -92,8 +92,8 @@ class BasePromptTest(object):
|
||||||
[], ["needs" + test_type.capitalize()], b'e\na\n')
|
[], ["needs" + test_type.capitalize()], b'e\na\n')
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN in stderr
|
||||||
assert not FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN not in stdout
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
assert b'Unrecognized option' in stderr
|
assert b'Unrecognized option' in stderr
|
||||||
|
|
||||||
def test_no_prompt(self):
|
def test_no_prompt(self):
|
||||||
|
@ -101,7 +101,7 @@ class BasePromptTest(object):
|
||||||
code, stdout, stderr = self._run_deno(
|
code, stdout, stderr = self._run_deno(
|
||||||
["--no-prompt"], ["needs" + test_type.capitalize()], b'')
|
["--no-prompt"], ["needs" + test_type.capitalize()], b'')
|
||||||
assert code == 1
|
assert code == 1
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN in stdout
|
||||||
assert PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN in stderr
|
||||||
|
|
||||||
|
@ -111,9 +111,9 @@ class BasePromptTest(object):
|
||||||
["--no-prompt", "--allow-" + test_type],
|
["--no-prompt", "--allow-" + test_type],
|
||||||
["needs" + test_type.capitalize()], b'')
|
["needs" + test_type.capitalize()], b'')
|
||||||
assert code == 0
|
assert code == 0
|
||||||
assert not PROMPT_PATTERN in stderr
|
assert PROMPT_PATTERN not in stderr
|
||||||
assert not FIRST_CHECK_FAILED_PATTERN in stdout
|
assert FIRST_CHECK_FAILED_PATTERN not in stdout
|
||||||
assert not PERMISSION_DENIED_PATTERN in stderr
|
assert PERMISSION_DENIED_PATTERN not in stderr
|
||||||
|
|
||||||
|
|
||||||
class ReadPromptTest(DenoTestCase, BasePromptTest):
|
class ReadPromptTest(DenoTestCase, BasePromptTest):
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
# 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 os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from distutils.spawn import find_executable
|
from distutils.spawn import find_executable
|
||||||
import prebuilt
|
|
||||||
import argparse
|
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 = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
|
|
@ -1,27 +1,25 @@
|
||||||
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from setup import gn_string, read_gn_args, write_gn_args
|
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
from tempfile import mktemp
|
from tempfile import mktemp
|
||||||
|
from setup import gn_string, read_gn_args, write_gn_args
|
||||||
from test_util import DenoTestCase, run_tests
|
from test_util import DenoTestCase, run_tests
|
||||||
|
|
||||||
|
|
||||||
class TestSetup(DenoTestCase):
|
class TestSetup(DenoTestCase):
|
||||||
def test_gn_string(self):
|
def test_gn_string(self):
|
||||||
assert '"abc"' == gn_string('abc')
|
assert gn_string('abc') == '"abc"'
|
||||||
assert '"foo\\$bar\\"baz"' == gn_string('foo$bar"baz')
|
assert gn_string('foo$bar"baz') == '"foo\\$bar\\"baz"'
|
||||||
assert '"do\\not\\escape"' == gn_string('do\\not\\escape')
|
assert gn_string('do\\not\\escape') == '"do\\not\\escape"'
|
||||||
assert '"so\\\\\\very\\\\\\"fun\\"' == gn_string('so\\\\very\\"fun\\')
|
assert gn_string('so\\\\very\\"fun\\') == '"so\\\\\\very\\\\\\"fun\\"'
|
||||||
|
|
||||||
def test_read_gn_args(self):
|
def test_read_gn_args(self):
|
||||||
# Args file doesn't exist.
|
# Args file doesn't exist.
|
||||||
(args,
|
(args,
|
||||||
hand_edited) = read_gn_args("/baddir/hopefully/nonexistent/args.gn")
|
hand_edited) = read_gn_args("/baddir/hopefully/nonexistent/args.gn")
|
||||||
assert args is None
|
assert args is None
|
||||||
assert hand_edited == False
|
assert not hand_edited
|
||||||
|
|
||||||
# Handwritten empty args file.
|
# Handwritten empty args file.
|
||||||
filename = mktemp()
|
filename = mktemp()
|
||||||
|
@ -30,7 +28,7 @@ class TestSetup(DenoTestCase):
|
||||||
(args, hand_edited) = read_gn_args(filename)
|
(args, hand_edited) = read_gn_args(filename)
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
assert args == []
|
assert args == []
|
||||||
assert hand_edited == True
|
assert hand_edited
|
||||||
|
|
||||||
# Handwritten non-empty args file.
|
# Handwritten non-empty args file.
|
||||||
expect_args = ['some_number=2', 'another_string="ran/dom#yes"']
|
expect_args = ['some_number=2', 'another_string="ran/dom#yes"']
|
||||||
|
@ -40,7 +38,7 @@ class TestSetup(DenoTestCase):
|
||||||
(args, hand_edited) = read_gn_args(filename)
|
(args, hand_edited) = read_gn_args(filename)
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
assert args == expect_args
|
assert args == expect_args
|
||||||
assert hand_edited == True
|
assert hand_edited
|
||||||
|
|
||||||
def test_write_gn_args(self):
|
def test_write_gn_args(self):
|
||||||
# Build a nonexistent path; write_gn_args() should call mkdir as needed.
|
# 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.
|
# Validate that the right contents were written.
|
||||||
(check_args, hand_edited) = read_gn_args(filename)
|
(check_args, hand_edited) = read_gn_args(filename)
|
||||||
assert check_args == args
|
assert check_args == args
|
||||||
assert hand_edited == False
|
assert not hand_edited
|
||||||
# Clean up.
|
# Clean up.
|
||||||
rmtree(d)
|
rmtree(d)
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# This program fails if ./tools/format.py changes any files.
|
# This program fails if ./tools/format.py changes any files.
|
||||||
|
|
||||||
import sys
|
|
||||||
import util
|
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import util
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
# This script contains helper functions to work with the third_party subrepo.
|
# This script contains helper functions to work with the third_party subrepo.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from os import path
|
||||||
import site
|
import site
|
||||||
import sys
|
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 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.
|
# 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,
|
cwd=third_party_path,
|
||||||
merge_env=pip_env)
|
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.
|
# Remove the temporary pip installation.
|
||||||
rmtree(temp_python_home)
|
rmtree(temp_python_home)
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import util
|
|
||||||
import time
|
import time
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import util
|
||||||
|
|
||||||
MB = 1024 * 1024
|
MB = 1024 * 1024
|
||||||
ADDR = "127.0.0.1:4544"
|
ADDR = "127.0.0.1:4544"
|
||||||
|
|
|
@ -8,18 +8,18 @@ from util import (parse_exit_code, shell_quote_win, parse_wrk_output,
|
||||||
|
|
||||||
class TestUtil(DenoTestCase):
|
class TestUtil(DenoTestCase):
|
||||||
def test_parse_exit_code(self):
|
def test_parse_exit_code(self):
|
||||||
assert 54 == parse_exit_code('hello_error54_world')
|
assert parse_exit_code('hello_error54_world') == 54
|
||||||
assert 1 == parse_exit_code('hello_error_world')
|
assert parse_exit_code('hello_error_world') == 1
|
||||||
assert 0 == parse_exit_code('hello_world')
|
assert parse_exit_code('hello_world') == 0
|
||||||
|
|
||||||
def test_shell_quote_win(self):
|
def test_shell_quote_win(self):
|
||||||
assert 'simple' == shell_quote_win('simple')
|
assert shell_quote_win('simple') == 'simple'
|
||||||
assert 'roof/\\isoprojection' == shell_quote_win(
|
assert shell_quote_win(
|
||||||
'roof/\\isoprojection')
|
'roof/\\isoprojection') == 'roof/\\isoprojection'
|
||||||
assert '"with space"' == shell_quote_win('with space')
|
assert shell_quote_win('with space') == '"with space"'
|
||||||
assert '"embedded""quote"' == shell_quote_win('embedded"quote')
|
assert shell_quote_win('embedded"quote') == '"embedded""quote"'
|
||||||
assert '"a""b""""c\\d\\\\""e\\\\\\\\"' == shell_quote_win(
|
assert shell_quote_win(
|
||||||
'a"b""c\\d\\"e\\\\')
|
'a"b""c\\d\\"e\\\\') == '"a""b""""c\\d\\\\""e\\\\\\\\"'
|
||||||
|
|
||||||
def test_parse_wrk_output(self):
|
def test_parse_wrk_output(self):
|
||||||
f = open(os.path.join(root_path, "tools/testdata/wrk1.txt"))
|
f = open(os.path.join(root_path, "tools/testdata/wrk1.txt"))
|
||||||
|
|
Loading…
Reference in a new issue