Skip to content

Commit

Permalink
Move plugin registration out of robot project
Browse files Browse the repository at this point in the history
  • Loading branch information
justinb4003 committed Dec 12, 2024
1 parent bd7f85a commit ae95c08
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions pyfrc/mains/cli_add_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,6 @@
from pyfrc.tests import *
"""

conftest = """'''
This file registesr the PyFrcPlugin so it can be found during
distributed tests with pytest-xdist
'''
import sys
import pathlib
from pyfrc.test_support.pytest_plugin import PyFrcPlugin
# Add the location of robot.py to our path
parentdir = pathlib.Path(__file__).parent.parent
sys.path.append(str(parentdir))
import robot
def pytest_configure(config):
if config.pluginmanager.has_plugin("pyfrc_plugin"):
# Avoid double registration
return
robot_class = robot.MyRobot
robot_file = parentdir/'robot.py'
plugin = PyFrcPlugin(robot_class, robot_file)
config.pluginmanager.register(plugin, "pyfrc_plugin")
"""


class PyFrcAddTests:
"""
Expand Down Expand Up @@ -72,13 +48,4 @@ def run(self, main_file: pathlib.Path, project_path: pathlib.Path):
fp.write(builtin_tests)
print("- builtin tests created at", builtin_tests_file)

conftest_file = test_directory / "conftest.py"
if conftest_file.exists():
print("- conftest.py already exists")
else:
with open(conftest_file, "w") as fp:
fp.write(conftest)
print("- conftest created at", conftest_file)

print()
print("Robot tests can be ran via 'robotpy test'")

0 comments on commit ae95c08

Please sign in to comment.