Skip to content

test(fc-commands): cover accel-cal cancel and SCALED_IMU helpers - #1834

Open
iacker wants to merge 1 commit into
ArduPilot:RC_Calibrationfrom
iacker:test/rc-cal-backend-cmds-accel-imu
Open

test(fc-commands): cover accel-cal cancel and SCALED_IMU helpers#1834
iacker wants to merge 1 commit into
ArduPilot:RC_Calibrationfrom
iacker:test/rc-cal-backend-cmds-accel-imu

Conversation

@iacker

@iacker iacker commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Following up on the RCCalibrationDataModel test suite, this adds hardware-free tests for three FlightControllerCommands methods added on the RC_Calibration branch (#1816) that currently have zero coverage:

Method Tests
cancel_accel_calibration all-zero PREFLIGHT_CALIBRATION abort command, vehicle-position reset, no-connection guard, send-exception handling
poll_scaled_imu (xacc, yacc, zacc) float triple, no-message → None, no-connection → None, exception swallowed → None
request_scaled_imu_messages ACK success path, requested interval forwarded to the command, no-connection guard

Why

#1816 is flagged as WIP that "needs a lot more testing". These three backend methods are pure command/telemetry logic, so they can be fully exercised with the existing mock_connected_master fixture — no flight controller or SITL needed. This locks in their behaviour (especially the graceful-failure paths) while the RC calibration feature keeps evolving.

Validation

  • 11 new tests, all green
  • Full test_backend_flightcontroller_commands.py suite: 63 passed
  • ruff check clean on the modified file
  • Uses only the shared mock_connected_master fixture; no new fixtures or dependencies

Based on RC_Calibration so it merges cleanly alongside the WIP. Happy to rebase if the branch moves.

/kind cleanup

Add hardware-free BDD tests for three previously-uncovered
FlightControllerCommands methods introduced on the RC_Calibration branch:

- cancel_accel_calibration: verifies the all-zero PREFLIGHT_CALIBRATION
  abort command, vehicle-position reset, no-connection guard, and
  send-exception handling.
- poll_scaled_imu: verifies the (xacc, yacc, zacc) float triple, the
  no-message and no-connection None paths, and exception swallowing.
- request_scaled_imu_messages: verifies the ACK success path, that the
  requested interval is forwarded, and the no-connection guard.

All mocked via the shared mock_connected_master fixture; no flight
controller required.
@iacker
iacker requested a review from amilcarlucas as a code owner July 16, 2026 18:38
@iacker

iacker commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Heads-up on the red CI: none of the failures come from this PR. All failing tests are in the frontend tkinter files that already exist on the RC_Calibration base branch (test_frontend_tkinter_accelerometer_calibration.py, test/unit_frontend_tkinter_compass_calibration.py) — e.g. AttributeError: 'CompassCalibrationPopup' object has no attribute 'root' and the pyright Toplevel | Tk errors in frontend_tkinter_calibration_popup_base.py. Those are pre-existing on #1816.

My change only appends to tests/test_backend_flightcontroller_commands.py; that file passes clean:

tests/test_backend_flightcontroller_commands.py .... 63 passed
ruff check: All checks passed

Once the WIP frontend on RC_Calibration is fixed, this branch should go green with no changes on my side. Happy to rebase whenever.

@amilcarlucas

Copy link
Copy Markdown
Collaborator

Yes, I did refactor some files and that broke some of the tests. I`ll fix that.

Thanks for adding these tests.

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.

2 participants