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.IterativeRobot and 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 *
pyfrc.tests.basic.test_autonomous(control)[source]

Runs autonomous mode by itself

pyfrc.tests.basic.test_disabled(control, robot)[source]

Runs disabled mode by itself

pyfrc.tests.basic.test_operator_control(control)[source]

Runs operator control mode by itself

pyfrc.tests.basic.test_practice(control)[source]

Runs through the entire span of a practice match

Docstring tests

pyfrc.tests.docstring_test.ignore_object(o, robot_path)[source]

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)[source]

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.