Context
PR #68 added _ensure_data() / trigger_one_shot() to HTS221, which auto-triggers a one-shot conversion when the sensor is in power-down or one-shot mode. However, the existing mock scenario (hts221.yaml) initializes CTRL_REG1 as 0x85 (powered-on, continuous mode), so the auto-trigger path is never exercised in mock tests.
Flagged by Copilot review on PR #68.
Expected
Add a mock test (or extend the existing scenario) that:
- Starts with CTRL_REG1 in power-down mode (PD=0, e.g.
0x00) and verifies that calling temperature() / humidity() / read() triggers the expected register writes (CTRL_REG1 set to one-shot config, CTRL_REG2 ONE_SHOT bit set via read-modify-write).
- Starts with CTRL_REG1 in one-shot mode (PD=1, ODR=0, e.g.
0x84) and verifies the same behavior.
Files
tests/scenarios/hts221.yaml — add new test cases
lib/hts221/hts221/device.py — code under test (no changes expected)
Context
PR #68 added
_ensure_data()/trigger_one_shot()to HTS221, which auto-triggers a one-shot conversion when the sensor is in power-down or one-shot mode. However, the existing mock scenario (hts221.yaml) initializes CTRL_REG1 as0x85(powered-on, continuous mode), so the auto-trigger path is never exercised in mock tests.Flagged by Copilot review on PR #68.
Expected
Add a mock test (or extend the existing scenario) that:
0x00) and verifies that callingtemperature()/humidity()/read()triggers the expected register writes (CTRL_REG1 set to one-shot config, CTRL_REG2 ONE_SHOT bit set via read-modify-write).0x84) and verifies the same behavior.Files
tests/scenarios/hts221.yaml— add new test caseslib/hts221/hts221/device.py— code under test (no changes expected)