Skip to content
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

Make Command tests use command factories and decorators. #7006

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

TheComputer314
Copy link

@TheComputer314 TheComputer314 commented Aug 25, 2024

Closes #6652.

@TheComputer314 TheComputer314 requested a review from a team as a code owner August 25, 2024 15:47
Copy link
Contributor

This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR.

@TheComputer314
Copy link
Author

/format

Copy link
Contributor

@spacey-sooty spacey-sooty left a comment

Choose a reason for hiding this comment

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

Looks good to me but needs C++ and Python ports

@TheComputer314 TheComputer314 marked this pull request as draft September 22, 2024 04:22
@TheComputer314
Copy link
Author

/format

@TheComputer314 TheComputer314 marked this pull request as ready for review October 31, 2024 19:59
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, but overall, great work! Unfortunately, some usages of new RunCommand() were added to CommandDecoratorTest since the issue was opened, so those will also need to be converted. There's some spots in C++ that should be adjusted, but they involve replacing command types with CommandPtr, which is a little more complicated. If you want to learn a little bit of C++ and work on doing it, go ahead! If you want help, just let us know (in this issue or on Discord) and we'll be happy to help too.
Here's the missing spots in C++ (that I've noticed, I might've missed some):

  • AddRequirementsTest
  • CommandDecoratorTest.WithName
  • InstantCommandTest
  • ParallelCommandGroupTest.ParallelGroupNotScheduledCancel
  • ParallelCommandGroupTest.ParallelGroupCopy
  • ParallelCommandGroupTest.ParallelGroupRequirement
  • ParallelDeadlineGroupTest.DeadlineGroupNotScheduledCancel
  • ParallelDeadlineGroupTest.ParallelDeadlineCopy
  • ParallelDeadlineGroupTest.ParallelDeadlineRequirement
  • ParallelRaceGroupTest.ParallelRaceNotScheduledCancel
  • ParallelRaceGroupTest.ParallelRaceCopy
  • ParallelRaceGroupTest.RaceGroupRequirement
  • ParallelRaceGroupTest.ParallelRaceOnlyCallsEndOnce
  • PrintCommandTest
  • ProxyCommandTest.OwningCommandSchedule
  • ProxyCommandTest.OwningCommandEnd
  • POVButtonTest.SetPOV
  • RunCommandTest.RunCommandSchedule
  • ScheduleCommandTest.ScheduleCommandSchedule
  • SchedulerTest.SchedulerLambdaInterruptCause
  • SchedulerTest.SchedulerLambdaInterruptCauseInRunLoop
  • SchedulingRecursionTest.ScheduleFromEndCancel
  • SchedulingRecursionTest.ScheduleFromEndInterrupt
  • SchedulingRecursionTest.ScheduleFromEndInterruptAction
  • SchedulingRecursionTest.CancelDefaultCommandFromEnd
  • SelectCommandTest.SelectCommandRequirement
  • SequentialCommandGroupTest.SequentialGroupCopy
  • SequentialCommandGroupTest.SequentialGroupRequirement

@TheComputer314 TheComputer314 changed the title Make Java Command tests use command factories and decorators. Make Command tests use command factories and decorators. Nov 18, 2024
@rzblue
Copy link
Member

rzblue commented Nov 18, 2024

but they involve replacing command types with CommandPtr, which is a little more complicated.

Some of the tests are going to be better kept as-is, don't try to force them to work with decorators.

@TheComputer314 TheComputer314 force-pushed the factories-in-command-tests branch from 4fb7c92 to 8d936c7 Compare December 7, 2024 02:30
@TheComputer314 TheComputer314 force-pushed the factories-in-command-tests branch from 8d936c7 to 4e14491 Compare December 7, 2024 02:31
@github-actions github-actions bot added the component: command-based WPILib Command Based Library label Dec 8, 2024
Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

I'm a bit iffy about using factories instead of the command constructors in tests that are specifically testing those command types, but the command constructors also don't support CommandPtr. I could see either way (replacing command constructors in command type tests with factories or not using any factories in command type tests) being fine. @rzblue thoughts?

Copy link
Contributor

@KangarooKoala KangarooKoala left a comment

Choose a reason for hiding this comment

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

Submitted before I meant to, whoops. I've also updated my comment with a list of what needs to be changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: command-based WPILib Command Based Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[cmd] Use command factories and decorators in command tests
4 participants