core icon indicating copy to clipboard operation
core copied to clipboard

Late-import some modules required via conftest

Open akx opened this issue 1 year ago • 2 comments

Proposed change

This PR gently adjusts some imports to happen within late and/or within TYPE_CHECKING blocks to make it possible to run tests for a given component without requiring that many unnecessary dependencies.

This does not fully fix the situation; sqlalchemy and fnvhash are required by recorder, which was much harder to untangle than these, but those are still not automatically installed in e.g. a GitHub Codespace (they're e.g. not in requirements_test.txt).

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)
  • [x] Code quality improvements to existing code or addition of tests

Checklist

  • [x] The code change is tested and works locally.
  • [ ] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] The code has been formatted using Black (black --fast homeassistant tests)
  • [ ] Tests have been added to verify that the new code works.

To help with the load of incoming pull requests:

akx avatar Nov 06 '22 19:11 akx

Hey there @emontnemery, mind taking a look at this pull request as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of mqtt can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign mqtt Removes the current integration label and assignees on the issue, add the integration domain after the command.

home-assistant[bot] avatar Nov 06 '22 19:11 home-assistant[bot]

Hey there @hunterjm, @uvjustin, @allenporter, mind taking a look at this pull request as it has been labeled with an integration (stream) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of stream can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign stream Removes the current integration label and assignees on the issue, add the integration domain after the command.

home-assistant[bot] avatar Nov 06 '22 19:11 home-assistant[bot]

As per @epenet's request, split into #81791 and #81790.

akx avatar Nov 08 '22 14:11 akx