Skip to content

Commit

Permalink
Merge pull request #219 from auscompgeek/cov-parallel
Browse files Browse the repository at this point in the history
cli_coverage: Add --parallel-mode
  • Loading branch information
virtuald authored Dec 22, 2023
2 parents 345bb30 + 6b2bfd4 commit 5b66b23
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions pyfrc/mains/cli_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)

0 comments on commit 5b66b23

Please sign in to comment.