mirror of
https://gitlab.com/openlp/runners.git
synced 2024-12-22 19:32:48 +00:00
Add the fixpaths.py script for fixing the combined coverage report paths
This commit is contained in:
parent
eabcccff6e
commit
3d09adc3c8
@ -8,3 +8,5 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive \
|
|||||||
python3-websockets python3-webob python3-waitress python3-requests python3-pymediainfo \
|
python3-websockets python3-webob python3-waitress python3-requests python3-pymediainfo \
|
||||||
python3-qtawesome python3-opengl python3-appdirs python3-vlc python3-zeroconf python3-pip \
|
python3-qtawesome python3-opengl python3-appdirs python3-vlc python3-zeroconf python3-pip \
|
||||||
python3-flake8 flake8 mediainfo mupdf-tools xvfb
|
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