Custom Test Support
pytest fixtures
- class pyfrc.test_support.pytest_plugin.PyFrcPlugin(robot_class, robot_file)[source]
Pytest plugin. Each documented member function name can be an argument to your test functions, and the data that these functions return will be passed to your test function.
- control(reraise, robot)[source]
A pytest fixture that provides control over your robot
- Return type:
Controlling the robot’s state
- class pyfrc.test_support.controller.TestController(reraise, robot)[source]
Use this object to control the robot’s state during tests
- property robot_is_alive: bool
True if the robot code is alive
- run_robot()[source]
Use this in a “with” statement to start your robot code at the beginning of the with block, and end your robot code at the end of the with block.
Your robotInit function will not be called until this function is called.
- step_timing(*, seconds, autonomous, enabled, assert_alive=True)[source]
This utility will increment simulated time, while pretending that there’s a driver station connected and delivering new packets every 0.2 seconds.
- Parameters:
seconds (
float
) – Number of seconds to run (will step in increments of 0.2)autonomous (
bool
) – Tell the robot that it is in autonomous modeenabled (
bool
) – Tell the robot that it is enabled
- Return type:
float
- Returns:
Number of seconds time was incremented