Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions pyfrc/mains/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class _TryAgain(Exception):
#
# main test class
#


class PyFrcTest:
"""
Executes unit tests on the robot code using a special pytest plugin
Expand Down Expand Up @@ -58,6 +60,13 @@ def __init__(self, parser=None):
nargs="*",
help="To pass args to pytest, specify --<space>, then the args",
)
parser.add_argument(
"-j",
"--jobs",
type=int,
default=-1,
help="Maximum isolated robot processes (default: max CPUs - 1)",
)

def run(
self,
Expand All @@ -69,6 +78,7 @@ def run(
coverage_mode: bool,
verbose: bool,
pytest_args: typing.List[str],
jobs: int,
):
if isolated is None:
pyproject_path = project_path / "pyproject.toml"
Expand Down Expand Up @@ -107,6 +117,7 @@ def run(
coverage_mode,
verbose,
pytest_args,
jobs,
)
except _TryAgain:
return self._run_test(
Expand All @@ -118,6 +129,7 @@ def run(
coverage_mode,
verbose,
pytest_args,
jobs,
)

def _run_test(
Expand All @@ -130,6 +142,7 @@ def _run_test(
coverage_mode: bool,
verbose: bool,
pytest_args: typing.List[str],
jobs: int,
):
# find test directory, change current directory so pytest can find the tests
# -> assume that tests reside in tests or ../tests
Expand Down Expand Up @@ -159,13 +172,13 @@ def _run_test(

try:
if isolated:
from ..test_support import pytest_dist_plugin
from ..test_support import pytest_isolated_tests_plugin

retv = pytest.main(
pytest_args,
plugins=[
pytest_dist_plugin.DistPlugin(
robot_class, main_file, builtin, verbose
pytest_isolated_tests_plugin.IsolatedTestsPlugin(
robot_class, main_file, builtin, verbose, jobs
)
],
)
Expand Down
192 changes: 0 additions & 192 deletions pyfrc/test_support/pytest_dist_plugin.py

This file was deleted.

Loading