Skip to content

Set up the config entry directly in Nmap Tracker tests - #195368

Open
joostlek wants to merge 1 commit into
devfrom
clanker/bold-hopper-ttda4g-nmap_tracker
Open

joostlek wants to merge 1 commit into
devfrom
clanker/bold-hopper-ttda4g-nmap_tracker

Conversation

@joostlek

Copy link
Copy Markdown
Member

Proposed change

The Nmap Tracker migration tests set up the integration with async_setup_component. This integration doesn't accept YAML, so that call only sets up its config entries. The tests now set up the config entry directly with hass.config_entries.async_setup(entry.entry_id).

The downgrade test doesn't assert the result, because the migration and so the setup is expected to fail there.

This fixes the home-assistant-tests-setup-component-config-entry pylint warning added in the linked PR.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests (refactoring, typing, performance, etc.)
  • Developer tooling (CI, GitHub workflows, linters and checkers, scripts, AI instructions, code owners)

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

  • I have reviewed two other [open pull requests][prs] in this repository.

[prs]: https://github.com/home-assistant/core/pulls?q=is%3Aopen+is%3Apr+-author%3A%40me+-draft%3Atrue+-label%3Awaiting-for-upstream+sort%3Acreated-desc+review%3Anone+-status%3Afailure


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SLHDn5tsVNcA5pGcA98Cfj
Copilot AI adaptive review requested due to automatic review settings November 29, 2026 18:17
@home-assistant

home-assistant Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

👋 Hi! Thanks for contributing to Home Assistant.

This is your PR dashboard which flags anything you need to address before your PR can be reviewed. Once everything is green, you can press the 'Ready for review' button at the bottom of the page to notify reviewers to take a look.

More information about this dashboard

This dashboard automatically updates on every change to this PR and reevaluates the rules as you go. Until everything has been addressed, the bot will keep the PR in draft.

Skip a check that doesn't apply

If you think a check doesn't apply to your PR (or the rule is bugged), comment @home-assistant ignore "<check name>" "<reason>". The check name as shown in the table above. This will mark the check as ignored and let you put your PR in 'Ready for review'; @home-assistant unignore "<check name>" restores the rule.

Bot commands

Reply with @home-assistant <command>. Several commands can be stacked, one per line:

  • update — Re-runs the bot's checks on the issue or pull request.
  • ignore — Waives a dashboard check: ignore "<check name>" "<reason>". (author) — e.g. @home-assistant ignore "Merge conflicts" "Broken rule, no merge conflicts present"
  • unignore — Restores a waived dashboard check: unignore "<check name>". (author) — e.g. @home-assistant unignore "Merge conflicts"
  • unassign — Removes the given integration domain's label and its code owners from the assignees. (author or code owners) — e.g. @home-assistant unassign "opensky"
  • close — Closes the issue or pull request. (code owners)
  • reopen — Reopens the issue or pull request. (code owners)
  • rename — Renames the issue or pull request: rename "<new title>". (code owners) — e.g. @home-assistant rename "A more descriptive title"
  • add-label — Adds a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the issue or pull request. (code owners) — e.g. @home-assistant add-label "needs-more-information"
  • remove-label — Removes a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) from the issue or pull request. (code owners) — e.g. @home-assistant remove-label "needs-more-information"
  • mark-draft — Marks the pull request as draft. (code owners)
  • update-branch — Updates the pull request branch with the base branch. (code owners)

Checks

✨ Everything's in order!

5 checks passed (5 skipped)
Status Check Details
✅ Forbidden files No forbidden files.
✅ Merge conflicts No merge conflicts.
✅ Merge target This PR targets dev.
✅ Type of change Type of change: code-quality
✅ CLA All commit authors are bots — nothing to sign.
➖ New integration validation Not a new-integration PR.
➖ Single new platform No new platforms added.
➖ Documentation Not a new integration or platform — no documentation PR required.
➖ Belongs together No pull requests listed.
➖ Code owner approval Touches no platinum integration — no code-owner approval required.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The migration tests now use direct config-entry setup, remove the unused import, and retain the existing migration and downgrade assertions without any active review issues.

No open issues 🎉

What changed in this PR

Updates the Nmap Tracker migration tests to initialize config entries directly, matching the integration's config-entry-only setup model and avoiding the new pylint warning.

Changes:

  • Replaces async_setup_component with hass.config_entries.async_setup.
  • Removes the unused async_setup_component import.
  • Preserves the expected migration-state assertions, including the downgrade failure behavior.
File Description
tests/​components/​nmap_tracker/​test_init.py Uses direct config-entry setup for the Nmap Tracker migration and downgrade migration tests.

Review effort: Lite (adaptive)

This branch has not been deployed

No deployments
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.

3 participants