8000 add on enable and on disable to test by LucienMorey · Pull Request #217 · robotpy/robotpy-wpilib-utilities · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

add on enable and on disable to test #217

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2025

Conversation

LucienMorey
Copy link
Contributor

Went in to deal with on_enable not being called in test and found out that on_disable gets double called for teleop and auto mode.

@LucienMorey
Copy link
Contributor Author

Is it worth adding a unit test while I am here to check that these methods run in the modes indicated in the docs? It looks like I might be able to do something similar to the test_feedbacks_with_type_hints test in test_magicbot_feedback.py and call each mode manually? i figure I just need a counter for each thing and then I can assert the expected increases as I go through each mode

Copy link
Member
@virtuald virtuald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems good to me. A test would be nice, but if it's hard I won't require it.

I guess I'm surprised you decided to not call the execute() functions from test mode? But maybe that's just too much.

@auscompgeek
Copy link
Member

I'm surprised you decided to not call the execute() functions from test mode?

IMO test mode should be a "get out of your way and avoid doing too much magic" mode. If you think calling on_enable() in test mode makes sense, then that's fine by me too. Wasn't sure if there was any particular rhyme and reason initially for not doing so.

@auscompgeek
Copy link
Member

It's always struck me as odd that on_disable() is double-called when disabling the robot. We can follow up with some tests in another PR.

@auscompgeek auscompgeek merged commit 2c535d4 into robotpy:main May 3, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0