Skip to content

tests: Add mock tests for HTS221 auto-trigger after poweroff.#96

Merged
nedseb merged 1 commit intomainfrom
fix/hts221-mock-auto-trigger
Mar 13, 2026
Merged

tests: Add mock tests for HTS221 auto-trigger after poweroff.#96
nedseb merged 1 commit intomainfrom
fix/hts221-mock-auto-trigger

Conversation

@nedseb
Copy link
Copy Markdown
Contributor

@nedseb nedseb commented Mar 13, 2026

Summary

Closes #95.

  • Add 3 mock tests exercising the _ensure_data() / trigger_one_shot() auto-trigger path:
    • Auto-trigger temperature after poweroff — calls poweroff() then temperature()
    • Auto-trigger humidity after poweroff — calls poweroff() then humidity()
    • Auto-trigger read after one-shot mode — calls trigger_one_shot() then read()
  • Add setup support in executor.py run_action() — allows calling methods on the driver instance before the main test action

Test plan

python3 -m pytest tests/ -k "hts221 and mock" -v

Mock test results

tests/test_scenarios.py::test_scenario[hts221/Verify device ID/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Read WHO_AM_I via method/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Read temperature returns float/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Read humidity returns float/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Status register has data ready/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Auto-trigger temperature after poweroff/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Auto-trigger humidity after poweroff/mock] PASSED
tests/test_scenarios.py::test_scenario[hts221/Auto-trigger read after one-shot mode/mock] PASSED
8 passed
  • All mock tests pass (8/8 for HTS221, 44/44 total)
  • ruff check passes

@nedseb nedseb requested a review from Copilot March 13, 2026 13:32
@nedseb nedseb self-assigned this Mar 13, 2026
@nedseb nedseb added the test label Mar 13, 2026
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

This PR adds mock tests for the HTS221 driver's auto-trigger path (_ensure_data() / trigger_one_shot()), which was previously untested in mock mode. It also introduces a setup mechanism in the test executor to call driver methods before the main test action.

Changes:

  • Added 3 new mock-only YAML test scenarios exercising the auto-trigger path after poweroff() and trigger_one_shot()
  • Added setup step support in executor.py's run_action() to call preparatory methods before the main action

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/scenarios/hts221.yaml Added 3 mock test cases for auto-trigger after poweroff/one-shot mode
tests/runner/executor.py Added setup step processing before the main action in run_action()

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

@nedseb nedseb merged commit 6c84c83 into main Mar 13, 2026
7 checks passed
@nedseb nedseb deleted the fix/hts221-mock-auto-trigger branch March 13, 2026 13:35
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Add mock test for HTS221 power-down/one-shot auto-trigger.

2 participants