Skip to content

Commit

Permalink
Moved the pytest_configure() hook to setup plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
justinb4003 committed Dec 12, 2024
1 parent d799237 commit bd7f85a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pyfrc/mains/cli_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,24 @@
# could be a useful thing. Will have to consider that later.


import sys
import pathlib
from pyfrc.test_support.pytest_plugin import PyFrcPlugin
# Tests are always run from the top directory of the robot project
# so the location of robot.py should be the current working directory
sys.path.append('.')
import robot

def pytest_configure(config):
if config.pluginmanager.has_plugin("pyfrc_plugin"):
# Avoid double registration
return
robot_class = robot.MyRobot
robot_file = './robot.py'
plugin = PyFrcPlugin(robot_class, robot_file)
config.pluginmanager.register(plugin, "pyfrc_plugin")


class _TryAgain(Exception):
pass

Expand Down

0 comments on commit bd7f85a

Please sign in to comment.