diff --git a/pyfrc/mains/cli_coverage.py b/pyfrc/mains/cli_coverage.py index 7c4cf51..de309ea 100644 --- a/pyfrc/mains/cli_coverage.py +++ b/pyfrc/mains/cli_coverage.py @@ -11,7 +11,10 @@ class PyFrcCoverage: the coverage module to be installed. """ - def __init__(self, parser): + def __init__(self, parser: argparse.ArgumentParser): + parser.add_argument( + "--parallel-mode", action="store_true", help="Run coverage in parallel mode" + ) parser.add_argument( "args", nargs=argparse.REMAINDER, help="Arguments to pass to robot.py" ) @@ -45,13 +48,20 @@ def run(self, options, robot_class, **static_options): "run", "--source", dirname(file_location), - file_location, - ] + list(options.args) + ] + if options.parallel_mode: + args.append("--parallel-mode") + + args.append(file_location) + args += option_args retval = subprocess.call(args) if retval != 0: return retval + if options.parallel_mode: + subprocess.call([sys.executable, "-m", "coverage", "combine"]) + args = [sys.executable, "-m", "coverage", "report", "-m"] return subprocess.call(args)