I have an odd thing I can’t figure out with PyTest…or pathplanner, or both.
When I run the tests with an extra summary report, here’s the output
python -m robotpy test -- -rpf
.......
====================================================== short test summary info ======================================================
PASSED pyfrc_test.py::test_autonomous
FAILED pyfrc_test.py::test_disabled - RuntimeError: AutoBuilder has already been configured. Please only configure AutoBuilder once
FAILED pyfrc_test.py::test_operator_control - RuntimeError: AutoBuilder has already been configured. Please only configure AutoBuilder once
FAILED pyfrc_test.py::test_practice - RuntimeError: AutoBuilder has already been configured. Please only configure AutoBuilder once
==================================================== 3 failed, 1 passed in 3.36s ====================================================
My code is only calling Autobuilder from Pathplanner in one spot, RobotInit.
So it would appear that somehow I’m in a state where the library knows that I’ve configured the builder once, but RobotInit() is being called once for each test run. I don’t understand how that is happening, or how to fix the tests.
# Use this configuration file to control what RobotPy packages are installed
# on your RoboRIO
#
[tool.robotpy]
# Version of robotpy this project depends on
robotpy_version = "2024.2.1.1"
# Which extra RobotPy components should be installed
# -> equivalent to `pip install robotpy[extra1, ...]
robotpy_extras = [
# "all"
#"apriltag",
"commands2",
# "cscore"
"navx",
# "pathplannerlib"
# "phoenix5",
"phoenix6",
# "playingwithfusion"
# "rev"
# "romi"
# "sim",
# "xrp"
]
# Other pip packages to install
requires = [
"robotpy-ctre==2024.1.1",
"robotpy-pathplannerlib",
]
Then I run python -m robotpy sync
pip list
robotpy 2024.2.1.1
...
robotpy-pathplannerlib 2024.1.3
...
I’m not 100% sure on this, maybe @virtuald can confirm. But I think since the requirement you have is just robotpy-pathplannerlib, any version will satisfy that. I believe that if you changed it to something like robotpy-pathplannerlib>=2024.1.6 it would get a new version if available (I think as long as its 2024.1.X).