Tests that come with pyfrc¶
pyfrc comes with testing functions that can be used to test basic functionality of just about any robot, including running through a simulated practice match.
These generic test modules can be applied to
wpilib.SampleRobot based robots.
The primary purpose of these tests is to run through your code and make sure that it doesn’t crash. If you actually want to test your code, you need to write your own custom tests to tease out the edge cases.
To use these, add the following to a python file in your tests directory:
from pyfrc.tests import *
Runs autonomous mode by itself
- pyfrc.tests.basic.test_disabled(control, robot)¶
Runs disabled mode by itself
Runs operator control mode by itself
Runs through the entire span of a practice match
- pyfrc.tests.docstring_test.ignore_object(o, robot_path)¶
Returns true if the object can be ignored
- pyfrc.tests.docstring_test.pedantic_docstrings = True¶
If you want to be really pedantic, enforce sphinx docstrings. Ha.
- pyfrc.tests.docstring_test.test_docstrings(robot, robot_path)¶
The purpose of this test is to ensure that all of your robot code has docstrings. Properly using docstrings will make your code more maintainable and look more professional.