-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugin loading order with Syrupy #198
Comments
This seems very plausible, see where homeassistant uses the same name of the fixture as syrupy itself. Given that this package is a plugin whereas the homeassistant tests Your fix is mentioned in this thread pytest-dev/pytest#935, which still seems unresolved. I'm not sure we can do anything about it other than putting it in the README for now. |
Yup, I was reading that thread earlier. Your assessment seems in line with the (little) I know about this. Putting it in the Readme seems like a good resolution. |
I am getting the same symptom, but also it fails because the custom serializer is not used (e.g. timestamps are not set to The workaround that works for me is to duplicate the from pytest_homeassistant_custom_component.syrupy import HomeAssistantSnapshotExtension
from syrupy.assertion import SnapshotAssertion
...
@pytest.fixture
def snapshot(snapshot: SnapshotAssertion) -> SnapshotAssertion:
"""Return snapshot assertion fixture with the Home Assistant extension."""
return snapshot.use_extension(HomeAssistantSnapshotExtension) |
I have encountered a situation where tests pass locally and fail in CI because the snapshots generated by Syrupy can't be found. I've found a solution to this issue which is to run the tests as
pytest -p syrupy
(or adding it toaddopts
under[tool:pytest]
in my config).I'm guessing that if Syrupy is loaded second, that the options to configure the directory override what's setup by
pytest_homeassistant_custom_component
, but I can't be sure.I don't know if there's a way to configure this to say it must be loaded after Syrupy, but that would probably be good. If not, maybe it may be useful to document it.
The text was updated successfully, but these errors were encountered: