mirror of
https://gitlab.com/openlp/runners.git
synced 2024-12-22 11:22:48 +00:00
Merge branch 'fix-combine-coverage' into 'master'
Add the fixpaths.py script for fixing the combined coverage report paths See merge request openlp/runners!6
This commit is contained in:
commit
e8fa66189f
@ -8,3 +8,5 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
|
||||
python3-websockets python3-webob python3-waitress python3-requests python3-pymediainfo \
|
||||
python3-qtawesome python3-opengl python3-appdirs python3-vlc python3-zeroconf python3-pip \
|
||||
python3-flake8 flake8 mediainfo mupdf-tools xvfb
|
||||
ADD fixpaths.py /usr/bin/fixpaths
|
||||
RUN chmod a+x /usr/bin/fixpaths
|
||||
|
29
fixpaths.py
Executable file
29
fixpaths.py
Executable file
@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
from argparse import ArgumentParser
|
||||
|
||||
from coverage import CoverageData
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = ArgumentParser()
|
||||
parser.add_argument('coveragefile', metavar='FILENAME', help='Path to the .coverage file')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def fix_paths(coverage_file):
|
||||
file_name = os.path.abspath(coverage_file)
|
||||
base_path = os.path.dirname(file_name)
|
||||
data = CoverageData()
|
||||
data.read_file(file_name)
|
||||
new_lines = {}
|
||||
for fname, report in data._lines.items():
|
||||
new_fname = os.path.join(base_path, fname.split('openlp/openlp/')[-1])
|
||||
new_lines[new_fname] = report
|
||||
data._lines = new_lines
|
||||
data.write_file(file_name)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = get_args()
|
||||
fix_paths(args.coveragefile)
|
Loading…
Reference in New Issue
Block a user