Coding style.

This commit is contained in:
Andrew Hamilton 2016-02-01 07:48:11 +00:00
parent 44949c6cf9
commit 6c22598a39

View file

@ -80,6 +80,7 @@ def get_ls_color_codes():
LS_COLOR_CODES = get_ls_color_codes()
TIMEOUT = "60"
def fix_input(input_):
@ -265,7 +266,7 @@ def python_unittests(path):
if str(path).endswith("_test.py"):
python_version = _python_version(path)
cmd = [path] if _has_shebang_line(path) else [python_version, path]
stdout, stderr, returncode = _do_command(["timeout", "20"] + cmd)
stdout, stderr, returncode = _do_command(["timeout", TIMEOUT] + cmd)
markup = pygments.lex(stderr, _python_console_lexer)
status = Status.ok if returncode == 0 else Status.problem
native_style = pygments.styles.get_style_by_name("native")
@ -281,7 +282,7 @@ def pydoc(path):
status, output = Status.normal, ""
try:
output = subprocess.check_output(
["timeout", "20", pydoc_exe, path])
["timeout", TIMEOUT, pydoc_exe, path])
output = fix_input(output)
except subprocess.CalledProcessError:
status = Status.not_applicable
@ -307,7 +308,7 @@ def python_coverage(path):
env = os.environ.copy()
env["COVERAGE_FILE"] = coverage_path
stdout, *rest = _do_command(
["timeout", "60", python_exe, "run", test_path], env=env)
["timeout", TIMEOUT, python_exe, "run", test_path], env=env)
stdout, *rest = _do_command(
[python_exe, "annotate", "--directory", temp_dir,
os.path.normpath(path)], env=env)
@ -321,8 +322,9 @@ python_coverage.dependencies = {"python-coverage", "python3-coverage"}
def python_profile(path):
stdout, *rest = _do_command(["timeout", "20", _python_version(path), "-m",
"cProfile", "--sort=cumulative", path])
stdout, *rest = _do_command(["timeout", TIMEOUT, _python_version(path),
"-m", "cProfile", "--sort=cumulative",
path])
return Status.normal, fill3.Text(stdout)
python_profile.dependencies = {"python", "python3"}