From patchwork Sat Apr 18 00:09:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 237960 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Fri, 17 Apr 2020 18:09:00 -0600 Subject: [PATCH v2 09/14] patman: Drop the python2 code in test coverage In-Reply-To: <20200418000905.239056-1-sjg@chromium.org> References: <20200418000905.239056-1-sjg@chromium.org> Message-ID: <20200417180829.v2.9.I4e2dfa6895375a695ff0c9a996d840a31f9c00aa@changeid> We don't need to run test coverage with Python 2 now. Drop the special-case code. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Changes in v2: None tools/patman/test_util.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tools/patman/test_util.py b/tools/patman/test_util.py index 76dbc21e3a..6575b11c1a 100644 --- a/tools/patman/test_util.py +++ b/tools/patman/test_util.py @@ -12,8 +12,6 @@ import command from io import StringIO -PYTHON = 'python%d' % sys.version_info[0] - def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): """Run tests and check that we get 100% coverage @@ -42,11 +40,14 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): glob_list += exclude_list glob_list += ['*libfdt.py', '*site-packages*', '*dist-packages*'] test_cmd = 'test' if 'binman' in prog else '-t' - cmd = ('PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools %s-coverage run ' - '--omit "%s" %s %s -P1' % (build_dir, PYTHON, ','.join(glob_list), + prefix = '' + if build_dir: + prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir + cmd = ('%spython3-coverage run ' + '--omit "%s" %s %s -P1' % (prefix, ','.join(glob_list), prog, test_cmd)) os.system(cmd) - stdout = command.Output('%s-coverage' % PYTHON, 'report') + stdout = command.Output('python3-coverage', 'report') lines = stdout.splitlines() if required: # Convert '/path/to/name.py' just the module name 'name' @@ -65,8 +66,8 @@ def RunTestCoverage(prog, filter_fname, exclude_list, build_dir, required=None): print(coverage) if coverage != '100%': print(stdout) - print("Type '%s-coverage html' to get a report in " - 'htmlcov/index.html' % PYTHON) + print("Type 'python3-coverage html' to get a report in " + 'htmlcov/index.html') print('Coverage error: %s, but should be 100%%' % coverage) ok = False if not ok: