Skip to content

Update states tests, reset message listeners on state change#870

Merged
1Blademaster merged 1 commit intomainfrom
869-fix-test_states
Nov 25, 2025
Merged

Update states tests, reset message listeners on state change#870
1Blademaster merged 1 commit intomainfrom
869-fix-test_states

Conversation

@1Blademaster
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings November 24, 2025 18:45
@1Blademaster 1Blademaster linked an issue Nov 24, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the state tests and adds a new method to clear message listeners when changing drone states. The primary change is introducing clearAllMessageListeners() to properly reset message listeners during state transitions, ensuring clean state management.

Key changes:

  • Split monolithic test_setState into separate focused test functions
  • Added clearAllMessageListeners() method to the Drone class
  • Integrated listener cleanup into the set_state endpoint to prevent listener accumulation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
radio/tests/test_states.py Refactored single test function into 5 separate test functions, each testing a specific state scenario with descriptive names and docstrings
radio/app/endpoints/states.py Added call to clearAllMessageListeners() to reset message listeners when changing states
radio/app/drone.py Added clearAllMessageListeners() method and refactored close() to use it instead of manual iteration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread radio/tests/test_states.py
Comment thread radio/tests/test_states.py
Comment thread radio/tests/test_states.py
Comment thread radio/tests/test_states.py
@1Blademaster 1Blademaster requested a review from a team November 24, 2025 18:54
Copy link
Copy Markdown
Contributor

@Kwash67 Kwash67 left a comment

Choose a reason for hiding this comment

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

lgtm👍

@1Blademaster 1Blademaster merged commit 4d5b110 into main Nov 25, 2025
13 checks passed
@1Blademaster 1Blademaster deleted the 869-fix-test_states branch November 25, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix test_states

3 participants