File: merge_junit_files.py

package info (click to toggle)
python-pbcommand 2.1.1%2Bgit20231020.28d1635-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,016 kB
  • sloc: python: 7,676; makefile: 220; sh: 73
file content (43 lines) | stat: -rw-r--r-- 1,004 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
"""
Utility to combine individual JUnit XML files.
"""

import argparse
import logging
import os
import sys

from pbcommand.cli import (get_default_argparser_with_base_opts,
                           pacbio_args_runner)
from pbcommand.utils import setup_log
from pbcommand.testkit import xunit

log = logging.getLogger(__name__)


def run(args):
    xunit.merge_junit_files(args.output_file, args.junit_file)
    return 0


def _get_parser():
    p = get_default_argparser_with_base_opts(
        version="0.1",
        description=__doc__)
    p.add_argument("junit_file", nargs="+", type=argparse.FileType('r'))
    p.add_argument("-o", "--output-file", dest="output_file", action="store",
                   default="junit_results_merged.xml")
    return p


def main(argv=sys.argv):
    return pacbio_args_runner(
        argv=argv[1:],
        parser=_get_parser(),
        args_runner_func=run,
        alog=log,
        setup_log_func=setup_log)


if __name__ == "__main__":
    sys.exit(main())