From 6c22598a39bb6c4490b15e45c604b5df3203752b Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Mon, 1 Feb 2016 07:48:11 +0000 Subject: [PATCH] Coding style. --- tools.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools.py b/tools.py index 3d9bb03..8b5cd8a 100644 --- a/tools.py +++ b/tools.py @@ -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"}