From 33f75aefae316bbf275a37949490b067203ffd3b Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 4 Feb 2016 19:47:52 +0000 Subject: [PATCH] Fixed a bug in the python3-coverage tool. --- BUGS | 2 +- tools.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/BUGS b/BUGS index 68f6d71..98d3333 100644 --- a/BUGS +++ b/BUGS @@ -3,7 +3,6 @@ Current Current (tool related) -- python-coverage is failing in the sub-directories of a project. - disassemble for python doesn't always work. - gut had an error with utf-8. A traceback printed directly on the screen, garbling the interface. @@ -213,6 +212,7 @@ Fixed - Scrolling in the help screen doesn't work with the arrow keys. - If vigil is started with eveything up-to-date the up-to-date message never appears. +- python-coverage is failing in the sub-directories of a project. Won't fix diff --git a/tools.py b/tools.py index ad711c5..495512c 100644 --- a/tools.py +++ b/tools.py @@ -316,10 +316,11 @@ def python_coverage(path): env["COVERAGE_FILE"] = coverage_path stdout, *rest = _do_command( [python_exe, "run", test_path], env=env, timeout=TIMEOUT) - stdout, *rest = _do_command( - [python_exe, "annotate", "--directory", temp_dir, - os.path.normpath(path)], env=env) - with open(os.path.join(temp_dir, path + ",cover"), "r") as f: + path = os.path.normpath(path) + stdout, *rest = _do_command([python_exe, "annotate", "--directory", + temp_dir, path], env=env) + flat_path = path.replace("/", "_") + with open(os.path.join(temp_dir, flat_path + ",cover"), "r") as f: stdout = f.read() return Status.normal, fill3.Text(_colorize_coverage_report(stdout)) else: