Skip to content

Conversation

@lboue
Copy link
Contributor

@lboue lboue commented Feb 1, 2026

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:

  1. test_q10_simple.py - Comprehensive test script with detailed debugging

    • Shows all available device properties and APIs
    • Verbose output for troubleshooting
    • Validates vacuum trait presence
  2. test_q10_vacuum.py - Streamlined test script for daily use

    • Quick device detection and selection
    • Clean, minimal output
    • Interactive menu for testing commands
  3. README.md - Complete documentation with:

    • Installation and setup instructions
    • Usage examples
    • Available commands reference
    • Troubleshooting guide

Features

Both scripts provide an interactive menu to test all

- 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
@lboue lboue force-pushed the test-q10-vacuum-trait branch from 3283fbb to aaac719 Compare February 1, 2026 07:21
lboue added 2 commits February 1, 2026 08:22
- 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
@lboue lboue mentioned this pull request Feb 1, 2026
@lboue lboue marked this pull request as ready for review February 1, 2026 07:49
Copilot AI review requested due to automatic review settings February 1, 2026 07:49
Copy link
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 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(
Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
await vacuum._command.send(
await vacuum.send_command(

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +76
device_idx = int(input("\nSelect device number: ")) - 1
device = devices[device_idx]
Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
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)}.")

Copilot uses AI. Check for mistakes.
Comment on lines +125 to +131
await cache.flush()

except Exception as e:
print(f"\n❌ Fatal error: {e}")
import traceback

traceback.print_exc()
Copy link

Copilot AI Feb 1, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +153 to +159
await cache.flush()

except Exception as e:
print(f"\n❌ Fatal error: {e}")
import traceback

traceback.print_exc()
Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
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()

Copilot uses AI. Check for mistakes.
print(f"\n❌ Fatal error: {e}")
import traceback

traceback.print_exc()
Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +67
device_idx = int(input("\nSelect device number: ")) - 1
device = devices[device_idx]
print(f"\n✅ Selected device: {device.name}")

Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
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)}.")

Copilot uses AI. Check for mistakes.
Comment on lines +215 to +216
device_idx = int(input("\nSelect device number: ")) - 1
device = devices[device_idx]
Copy link

Copilot AI Feb 1, 2026

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.

Suggested change
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)}.")

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +66
# 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}")
Copy link

Copilot AI Feb 1, 2026

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.

Copilot uses AI. Check for mistakes.
Comment on lines +210 to +217
# 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}")
Copy link

Copilot AI Feb 1, 2026

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.

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,135 @@
#!/usr/bin/env python3
Copy link

Copilot AI Feb 1, 2026

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.

Copilot uses AI. Check for mistakes.
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.

1 participant