-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Restore persistent directory when a download fails #5378
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||||
| { | ||||||||
| "tests/repositories/test_update_repository.py::test_update_repository_entity_download_exception_restores_backup": { | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/branches/main": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/contents/custom_components/example/manifest.json": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/contents/hacs.json": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/git/trees/1.0.0": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/releases": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/git/trees/main": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/releases": 1, | ||||||||
| "https://data-v2.hacs.xyz/appdaemon/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/critical/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/integration/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/plugin/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/python_script/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/removed/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/template/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/theme/data.json": 1, | ||||||||
| "https://raw.githubusercontent.com/hacs-test-org/integration-basic/1.0.0/README.md": 1, | ||||||||
| "https://raw.githubusercontent.com/hacs-test-org/integration-basic/2.0.0/hacs.json": 1 | ||||||||
| } | ||||||||
| } | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These snapshots are generated, not hand written. Leaving these as the fixture writes them. |
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||
| { | ||||||||
| "tests/repositories/test_update_repository.py::test_update_repository_entity_download_failure_keeps_persistent_directory": { | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/branches/main": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/contents/custom_components/example/manifest.json": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/contents/hacs.json": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/git/trees/1.0.0": 1, | ||||||||
| "https://api.github.com/repos/hacs-test-org/integration-basic/releases": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/git/trees/main": 1, | ||||||||
| "https://api.github.com/repos/hacs/integration/releases": 1, | ||||||||
| "https://data-v2.hacs.xyz/appdaemon/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/critical/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/integration/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/plugin/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/python_script/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/removed/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/template/data.json": 1, | ||||||||
| "https://data-v2.hacs.xyz/theme/data.json": 1, | ||||||||
| "https://github.com/hacs-test-org/integration-basic/archive/refs/heads/2.0.0.zip": 1, | ||||||||
| "https://github.com/hacs-test-org/integration-basic/archive/refs/tags/2.0.0.zip": 1, | ||||||||
| "https://raw.githubusercontent.com/hacs-test-org/integration-basic/1.0.0/README.md": 1, | ||||||||
| "https://raw.githubusercontent.com/hacs-test-org/integration-basic/1.0.0/custom_components/example/manifest.json": 1, | ||||||||
| "https://raw.githubusercontent.com/hacs-test-org/integration-basic/2.0.0/hacs.json": 1 | ||||||||
| } | ||||||||
| } | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These snapshots are generated, not hand written. Leaving these as the fixture writes them. |
||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the repo.localpath inside the configuration directory which we've set to be inside a tmp directory for the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. For an integration
localpathis{hacs.core.config_path}/custom_components/{domain}, andhacs.core.config_pathis set fromhass.config.path(), which thehassfixture points at pytest's tmp dir. Printed during a run it resolves to/tmp/pytest-of-<user>/pytest-<n>/test_update_repository_entity_0/custom_components/example, so the test only writes inside the temporary configuration directory.The backup and persistent directory that the code moves things through do land in the real system temp dir (
tempfile.gettempdir(), so/tmp/hacs_backup/and/tmp/hacs_persistent_integration/), but that is existing behavior ofutils/backup.pythat all the other download tests share, not something this test introduces.