-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
oauth2 scaffold code doesn't have working unit tests setup for a custom component #113223
Comments
Hey there @home-assistant/core, mind taking a look at this issue as it has been labeled with an integration ( Code owner commandsCode owners of
(message by CodeOwnersMention) application_credentials documentation |
Could this be related to the fact that |
I have been able to validate that the generate code works for a core component test but not for a custom component. |
I noticed that you don't have a contest file with the auto_enable_custom_integrations(enable_custom_integrations) fixture like mentioned in the pytest-homeassistant-custom-component readme. Not sure if it fixes this, but might want to check that. |
Thanks for the hint, tried that, doesn't work. As the code works within HA I am closing the issue here, has to something todo with pytest-homeassistant-custom-component MatthewFlamm/pytest-homeassistant-custom-component#180 |
The problem
I have migrated the custom component daikin_onecta to oauth2 application_credentials and I want to add unit tests now. As part of this effort I used the oauth2 scaffolding script as described at https://developers.home-assistant.io/docs/config_entries_config_flow_handler.
After making some minor changes to the code to get it to compile, I have a problem using the scaffolding generated test, it fails with
ValueError: No application_credentials platform for daikin_onecta
.As reproducer I have taken the generated daikin_onecta component and migrated it to its own repo, only made a few minor changes to get it to compile, see https://github.com/jwillemsen/haoauth2_test
When running
pytest tests
it fails with the error below. For the repository I have setup a github action CI which uses python 3.11 which fails in the same way.As I am completely lost why this happens creating this issue, shouldn't the scaffold regenerated code be usable for a custom component?
What version of Home Assistant Core has the issue?
core-2024.3.0
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
oauth2
Link to integration documentation on our website
https://www.home-assistant.io/integrations/application_credentials/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
Additional information
See https://github.com/jwillemsen/haoauth2_test for the test HA custom component to reproduce this
The text was updated successfully, but these errors were encountered: