summaryrefslogtreecommitdiff
path: root/tools/u_boot_pylib/test_util.py
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-07-03 09:05:52 -0600
committerTom Rini <trini@konsulko.com>2024-07-03 09:05:52 -0600
commit4d3383623dd04be230ebb962c2f79bb3f3d502d9 (patch)
tree8c0b34c49d3a3cee72f6d9680ea0afc93d09f793 /tools/u_boot_pylib/test_util.py
parent65fbdab27224ee3943a89496b21862db83c34da2 (diff)
parentc85a05a5d87ce6f077c41d7e63a4a7953ddb351c (diff)
Merge tag 'dm-pull-2jun24-take2' of https://source.denx.de/u-boot/custodians/u-boot-dm
buildman CI improvements binman fixes and assumed size partial tools fixes for Python 3.12 patman enhancements
Diffstat (limited to 'tools/u_boot_pylib/test_util.py')
-rw-r--r--tools/u_boot_pylib/test_util.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/u_boot_pylib/test_util.py b/tools/u_boot_pylib/test_util.py
index f18d385d995..857ce58c98c 100644
--- a/tools/u_boot_pylib/test_util.py
+++ b/tools/u_boot_pylib/test_util.py
@@ -60,12 +60,17 @@ def run_test_coverage(prog, filter_fname, exclude_list, build_dir, required=None
prefix = ''
if build_dir:
prefix = 'PYTHONPATH=$PYTHONPATH:%s/sandbox_spl/tools ' % build_dir
- cmd = ('%spython3-coverage run '
- '--omit "%s" %s %s %s %s' % (prefix, ','.join(glob_list),
+
+ # Detect a Python virtualenv and use 'coverage' instead
+ covtool = ('python3-coverage' if sys.prefix == sys.base_prefix else
+ 'coverage')
+
+ cmd = ('%s%s run '
+ '--omit "%s" %s %s %s %s' % (prefix, covtool, ','.join(glob_list),
prog, extra_args or '', test_cmd,
single_thread or '-P1'))
os.system(cmd)
- stdout = command.output('python3-coverage', 'report')
+ stdout = command.output(covtool, 'report')
lines = stdout.splitlines()
if required:
# Convert '/path/to/name.py' just the module name 'name'