Open ScottG489 opened 1 year ago
Another option may be to allow devs to add these mocked custom components themselves. Although it could be beneficial to keep them synced with core, at least this way we could just write our own test custom components.
I think this could be done by overriding how get_test_config_dir()
works which currently points to somewhere in the phacc dependency dir (i.e. [...]/site-packages/pytest_homeassistant_custom_component/testing_config
) which obviously doesn't exist. Instead it could point to somewhere in the custom component's project such as tests/testing_config
.
If all we have to do is copy over the entire testing_config
folder, then this sounds fairly easy. We need part of that folder now anyway since the top level testing code now imports from within that structure.
Core has a variety of components mocked out so entities can be created and and interacted with in tests.
Would we ever consider including these mocks into this project so they can be used in custom component tests?
I believe this is somewhat what we're already doing for
recorder
, but I could be misunderstanding what that's here for exactly.I think my use case is somewhat unusual since I'm writing an integration that focuses on automation logic that interacts with other different components, whereas typically a custom component would only care about it's own domain. So I'd be interested in hearing your thoughts.