Skip to content

tests: Add multidriver temperature comparison scenario for calibration.#100

Merged
nedseb merged 6 commits intomainfrom
tests/multidriver-temperature-comparison
Mar 14, 2026
Merged

tests: Add multidriver temperature comparison scenario for calibration.#100
nedseb merged 6 commits intomainfrom
tests/multidriver-temperature-comparison

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 13, 2026

Closes #99

Summary

  • Add tests/scenarios/board_temperature_comparison.yaml — a type: board scenario that reads temperature from 4 sensors simultaneously for cross-validation and calibration
  • Add drivers field to board scenarios to trigger mounting lib/ via mpremote mount
  • Improve mpremote_bridge.py: run_raw_script() accepts mount_dir, diagnostic output is printed, error messages include both stderr and stdout
  • Adapt test_scenarios.py to pass mount_dir when scenario has drivers

Sensors compared

Sensor Type Method Result (sample)
HTS221 Hygrometer/thermometer temperature() 26.39°C
WSEN-PADS Barometer temperature() 25.86°C
WSEN-HIDS Hygrometer/thermometer temperature() 20.31°C
LIS2MDL Magnetometer (auxiliary) read_temperature_c() 23.5°C

Note: BQ27441 (battery gauge) was excluded — its __init__ calls enterConfig/sealed which crashes with ENODEV. ISM330DL (PR #50) will be added once merged (see #101). BME280 will be added once driver exists (see #102).

Tests

  1. Read all temperature sensors — reads 4 sensors, prints comparison table, checks thermometers in [5, 50]°C and spread < 8°C
  2. Temperature spread with barometer — cross-checks HTS221 vs WSEN-PADS spread < 5°C
  3. Manual validation — operator confirms values are coherent

Hardware validation results

--- Temperature Comparison ---
  HTS221      : 26.39 C
  WSEN-PADS   : 25.86 C
  WSEN-HIDS   : 20.31 C
  LIS2MDL     : 23.5 C
  Spread: 6.08 C

  HTS221: 26.35 C  |  WSEN-PADS: 25.86 C  |  Spread: 0.49 C

Observations

Related

Test plan

  • ruff check passes
  • pytest tests/ -k mock — 44/44 passed (no regressions)
  • pytest tests/ -k board --collect-only — 3 new tests collected
  • Hardware: pytest tests/ --port /dev/ttyACM0 -s -k "Temperature and comparison" — 3/3 passed

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

Adds a new hardware-only board qualification scenario to compare temperatures from multiple onboard sensors, and updates the hardware test runner to support mounting the repository lib/ on-device so multidriver scripts can import drivers during execution.

Changes:

  • Add tests/scenarios/board_temperature_comparison.yaml board scenario with 3 hardware checks (2 automated, 1 manual) comparing HTS221, WSEN-HIDS, WSEN-PADS, and LIS2MDL temperatures.
  • Extend MpremoteBridge.run_raw_script() to accept an optional mount_dir and print non-JSON diagnostic output before parsing the final JSON result.
  • Update tests/test_scenarios.py to mount lib/ for type: board scenarios when a drivers field is present.

Reviewed changes

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

File Description
tests/test_scenarios.py Mounts lib/ for board scenarios that declare drivers, then runs the script via run_raw_script(mount_dir=...).
tests/scenarios/board_temperature_comparison.yaml New multidriver board scenario that imports four drivers from /remote/* and performs spread/range checks plus a manual coherence check.
tests/runner/mpremote_bridge.py Improves mpremote failure detail selection and adds mount_dir + diagnostic printing to run_raw_script().

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

Comment thread tests/runner/mpremote_bridge.py Outdated
Comment thread tests/runner/mpremote_bridge.py
Comment thread tests/scenarios/board_temperature_comparison.yaml Outdated
Comment thread tests/scenarios/board_temperature_comparison.yaml
Comment thread tests/scenarios/board_temperature_comparison.yaml Outdated
@nedseb nedseb force-pushed the tests/multidriver-temperature-comparison branch from 35e3b1a to 9f7d5ef Compare March 14, 2026 06:55
@nedseb
Copy link
Copy Markdown
Contributor Author

nedseb commented Mar 14, 2026

Suggestions Copilot prises en compte dans le commit 3822374 :

  1. _run() — stderr + stdout : le message d'erreur inclut maintenant les deux streams quand ils sont présents.
  2. run_raw_script() — gestion d'erreur JSON : try/except JSONDecodeError avec affichage complet de l'output du script.
  3. dedicatedthermometers : variable et commentaires renommés pour clarifier que WSEN-PADS (baromètre avec capteur de température intégré) est inclus.
  4. PR description : mise à jour — LIS2MDL utilise read_temperature_c() (plus de calcul en dur), ajout référence drivers: Harmonize two-point temperature calibration across all sensors. #103.
  5. Accents français : "températures", "cohérentes" corrigés dans le prompt manuel.

@nedseb nedseb merged commit 1d31bd0 into main Mar 14, 2026
3 checks passed
@nedseb nedseb deleted the tests/multidriver-temperature-comparison branch March 14, 2026 07:09
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request released test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Add multidriver temperature comparison scenario for calibration.

2 participants