Skip to content

Add integration tests for SSH Command using pytest-homeassistant-custom-component#8

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-integration-tests-for-component
Draft

Add integration tests for SSH Command using pytest-homeassistant-custom-component#8
Copilot wants to merge 2 commits intomainfrom
copilot/add-integration-tests-for-component

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

Adds real Home Assistant integration tests (using pytest-homeassistant-custom-component) mirroring the pattern from task_tracker PR #21, and relocates unit tests from test/ to tests/unit_tests/.

Test structure

  • tests/unit_tests/ — existing unit tests (moved from test/; path depth updated from parent×3parent×4)
  • tests/integration_tests/conftest.py — creates custom_components/ssh_command → <repo_root> symlink at test collection time so HA's loader discovers the component; provides auto_enable_custom_integrations fixture
  • tests/integration_tests/test_integration.py — 29 tests against a live in-process HomeAssistant instance, with only asyncssh patched out

Integration test coverage

Class What's tested
TestSetupEntry Coordinator in hass.data, service registered, single-instance guard
TestUnloadEntry Coordinator removed on unload
TestConfigFlow Entry created, second attempt aborted
TestExecuteServiceSuccess stdout/stderr/exit_status, password & key-file auth, inline & file input, custom timeout
TestExecuteServiceKnownHosts check_known_hosts=FalseNone, custom/missing file, default ~/.ssh/known_hosts
TestExecuteServiceValidation All 5 _validate_service_data error paths, including no coordinator present
TestExecuteServiceErrors All SSH exception types (HostKeyNotVerifiable, PermissionDenied, TimeoutError, gaierror, generic OSError)

Infra changes

  • requirements_integration_tests.txtpytest-homeassistant-custom-component==0.13.318
  • pytest.iniasyncio_mode = auto
  • .github/workflows/integration-tests.yml — new CI job running pytest tests/integration_tests/ -v
  • test.yml updated to discover -s tests/unit_tests
  • pylint.yml ignore-paths updated to ^tests/.*$
  • run_tests.sh updated to tests/unit_tests
  • .gitignore excludes custom_components/ (created at runtime by conftest.py)

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: gensyn <36128035+gensyn@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration tests for Task Tracker component Add integration tests for SSH Command using pytest-homeassistant-custom-component Mar 17, 2026
Copilot AI requested a review from gensyn March 17, 2026 17:09
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