-
Notifications
You must be signed in to change notification settings - Fork 64
Add Q10 VacuumTrait Test Scripts #758
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
base: main
Are you sure you want to change the base?
Conversation
- Add test_q10_simple.py: Interactive test script with detailed debug info - Add test_q10_vacuum.py: Basic test script for Q10 vacuum commands - Add test_q10_advanced.py: Advanced test suite with complex features - Add confirmation prompt for map creation mode to prevent accidents - Update README.md with comprehensive usage guide and troubleshooting
3283fbb to
aaac719
Compare
- Rename test_q10_*.py to run_q10_*.py to prevent pytest from treating them as unit tests - These are interactive scripts, not automated tests - Update README with new script names - Fixes pytest failures in CI
There was a problem hiding this 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 adds three example/test scripts and comprehensive documentation for testing the Q10 VacuumTrait functionality introduced in PR #754. The scripts provide different levels of testing and diagnostics for Q10 vacuum devices.
Changes:
- Added three test scripts with varying levels of detail: run_q10_vacuum.py (basic), run_q10_simple.py (detailed debug), and run_q10_advanced.py (comprehensive testing suite)
- Added comprehensive README.md with installation instructions, usage examples, command reference, and troubleshooting guide
- All scripts include authentication flow, device selection, and interactive menus for testing vacuum commands
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 13 comments.
| File | Description |
|---|---|
| examples/Q10/run_q10_vacuum.py | Basic test script with minimal output for quick testing of Q10 vacuum commands |
| examples/Q10/run_q10_simple.py | Detailed test script with comprehensive device diagnostics and verbose output |
| examples/Q10/run_q10_advanced.py | Advanced test suite with multiple cleaning modes, device status monitoring, and structured test categories |
| examples/Q10/README.md | Complete documentation including installation, usage instructions, command reference, and troubleshooting guide |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| continue | ||
|
|
||
| print(f"\n • {mode_name}") | ||
| await vacuum._command.send( |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is accessing the private attribute vacuum._command directly. This breaks encapsulation and could cause issues if the internal implementation of VacuumTrait changes. Consider adding a public method in the VacuumTrait class for sending custom commands with parameters, or use the existing public methods to avoid accessing private attributes.
| await vacuum._command.send( | |
| await vacuum.send_command( |
| device_idx = int(input("\nSelect device number: ")) - 1 | ||
| device = devices[device_idx] |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device selection input on line 75 lacks error handling for invalid inputs. If the user enters a non-numeric value or an out-of-range number, the script will crash with an exception. Consider adding a try-except block or input validation to handle ValueError (for non-numeric input) and IndexError (for out-of-range values) more gracefully.
| device_idx = int(input("\nSelect device number: ")) - 1 | |
| device = devices[device_idx] | |
| while True: | |
| selection = input("\nSelect device number: ") | |
| try: | |
| device_idx = int(selection) - 1 | |
| except ValueError: | |
| print("❌ Invalid input. Please enter a number corresponding to a device.") | |
| continue | |
| if 0 <= device_idx < len(devices): | |
| device = devices[device_idx] | |
| break | |
| else: | |
| print(f"❌ Invalid selection. Please enter a number between 1 and {len(devices)}.") |
| await cache.flush() | ||
|
|
||
| except Exception as e: | ||
| print(f"\n❌ Fatal error: {e}") | ||
| import traceback | ||
|
|
||
| traceback.print_exc() |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an exception occurs before line 125, the cache may not be flushed, potentially losing cached data. Consider using a try-finally block or ensuring cache.flush() is called in both the success and exception paths to guarantee the cache is properly flushed even when errors occur.
| await cache.flush() | ||
|
|
||
| except Exception as e: | ||
| print(f"\n❌ Fatal error: {e}") | ||
| import traceback | ||
|
|
||
| traceback.print_exc() |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an exception occurs before line 153, the cache may not be flushed, potentially losing cached data. Consider using a try-finally block or ensuring cache.flush() is called in both the success and exception paths to guarantee the cache is properly flushed even when errors occur.
| await cache.flush() | |
| except Exception as e: | |
| print(f"\n❌ Fatal error: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| except Exception as e: | |
| print(f"\n❌ Fatal error: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| finally: | |
| cache_obj = locals().get("cache") | |
| if cache_obj is not None: | |
| await cache_obj.flush() |
| print(f"\n❌ Fatal error: {e}") | ||
| import traceback | ||
|
|
||
| traceback.print_exc() |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If an exception occurs before line 268, the cache may not be flushed, potentially losing cached data. Consider using a try-finally block or ensuring cache.flush() is called in both the success and exception paths to guarantee the cache is properly flushed even when errors occur.
| traceback.print_exc() | |
| traceback.print_exc() | |
| # Ensure the cache is flushed even when a fatal error occurs | |
| if "cache" in locals(): | |
| try: | |
| await cache.flush() | |
| except Exception: | |
| # Suppress cache flush errors to avoid masking the original exception | |
| pass |
| device_idx = int(input("\nSelect device number: ")) - 1 | ||
| device = devices[device_idx] | ||
| print(f"\n✅ Selected device: {device.name}") | ||
|
|
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device selection input on line 64 lacks error handling for invalid inputs. If the user enters a non-numeric value or an out-of-range number, the script will crash with an exception. Consider adding a try-except block or input validation to handle ValueError (for non-numeric input) and IndexError (for out-of-range values) more gracefully.
| device_idx = int(input("\nSelect device number: ")) - 1 | |
| device = devices[device_idx] | |
| print(f"\n✅ Selected device: {device.name}") | |
| while True: | |
| selection = input("\nSelect device number: ").strip() | |
| try: | |
| device_idx = int(selection) - 1 | |
| except ValueError: | |
| print("❌ Invalid input. Please enter a number corresponding to a device.") | |
| continue | |
| if 0 <= device_idx < len(devices): | |
| device = devices[device_idx] | |
| print(f"\n✅ Selected device: {device.name}") | |
| break | |
| else: | |
| print(f"❌ Invalid device number. Please enter a number between 1 and {len(devices)}.") |
| device_idx = int(input("\nSelect device number: ")) - 1 | ||
| device = devices[device_idx] |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device selection input on line 215 lacks error handling for invalid inputs. If the user enters a non-numeric value or an out-of-range number, the script will crash with an exception. Consider adding a try-except block or input validation to handle ValueError (for non-numeric input) and IndexError (for out-of-range values) more gracefully.
| device_idx = int(input("\nSelect device number: ")) - 1 | |
| device = devices[device_idx] | |
| while True: | |
| selection = input(f"\nSelect device number (1-{len(devices)}): ").strip() | |
| try: | |
| device_idx = int(selection) - 1 | |
| device = devices[device_idx] | |
| break | |
| except ValueError: | |
| print("❌ Please enter a valid number.") | |
| except IndexError: | |
| print(f"❌ Please enter a number between 1 and {len(devices)}.") |
| # Select device | ||
| if len(devices) == 1: | ||
| device = devices[0] | ||
| print(f"\n✅ Using device: {device.name}") | ||
| else: | ||
| device_idx = int(input("\nSelect device number: ")) - 1 | ||
| device = devices[device_idx] | ||
| print(f"\n✅ Selected device: {device.name}") |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device selection logic doesn't handle the case where no devices are found (len(devices) == 0). If no devices are available, the else branch will be taken, prompting for input and then attempting to access an empty list, which will cause an IndexError. Consider adding a check for empty device list before the selection logic and returning early with an appropriate error message.
| # Select device | ||
| if len(devices) == 1: | ||
| device = devices[0] | ||
| print(f"\n✅ Using device: {device.name}") | ||
| else: | ||
| device_idx = int(input("\nSelect device number: ")) - 1 | ||
| device = devices[device_idx] | ||
| print(f"\n✅ Selected device: {device.name}") |
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The device selection logic doesn't handle the case where no devices are found (len(devices) == 0). If no devices are available, the else branch will be taken, prompting for input and then attempting to access an empty list, which will cause an IndexError. Consider adding a check for empty device list before the selection logic and returning early with an appropriate error message.
| @@ -0,0 +1,135 @@ | |||
| #!/usr/bin/env python3 | |||
Copilot
AI
Feb 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description mentions "test_q10_simple.py" and "test_q10_vacuum.py" but the actual files are named "run_q10_simple.py" and "run_q10_vacuum.py". This creates confusion between the PR description and actual file names. Consider either updating the PR description or renaming the files to maintain consistency.
Add Q10 VacuumTrait Test Scripts
This PR adds test scripts to verify the Q10 VacuumTrait functionality introduced in PR #754.
What's Added
Two test scripts in Q10:
test_q10_simple.py - Comprehensive test script with detailed debugging
test_q10_vacuum.py - Streamlined test script for daily use
README.md - Complete documentation with:
Features
Both scripts provide an interactive menu to test all