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.
Any advice?
My guess is that pathplannerlib has a global somewhere, which is not supported for RobotPy programs.
Update to the latest version. This should be fixed
My Toml file:
# 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
...
Still broken.
pip install -U robotpy-pathplannerlib
pip list
robotpy 2024.2.1.1
...
robotpy-pathplannerlib 2024.1.6
...
Tests all pass.
I put my results in here for posterity, in case for some reason they see the same problem with syncing to latest.
Is this the right list? The latest is 2024.1.6
No, I had to manually update with pip -U to get it to update.
Edit… now I see the copy paste error…will fix above.
1 Like
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).
Is this also fixed for Java? I was having a similar issue before but I worked around it.
Yes, you would need to put a version constraint in pyproject.toml to avoid having to run pip separately.
requires = [
...
"robotpy-pathplannerlib>=2024.1.6",
]
Yes, all languages will just print an error now instead of throwing