From cde45e2e7a0d4c87d11886f433c0f76941ef8eff Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 14 Dec 2021 16:30:22 +0100 Subject: [PATCH] Address pytest warnings (#3347) * Avoid accessing properties of udevice.parent The if statement currently causes access of a property of udevice.parent, leading to: tests/hardware/test_module.py: 104 warnings /workspaces/supervisor/supervisor/hardware/data.py:50: DeprecationWarning: Will be removed in 1.0. Access properties with Device.properties. Change the if statement to avoid property access and the deprecation warning. * Create task before using asyncio.wait() Avoid deprecation warnings such as: tests/store/test_custom_repository.py: 5 warnings /workspaces/supervisor/supervisor/store/__init__.py:113: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11. await asyncio.wait(tasks) --- supervisor/hardware/data.py | 2 +- supervisor/store/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/supervisor/hardware/data.py b/supervisor/hardware/data.py index ecd230cf1..d5ca51d34 100644 --- a/supervisor/hardware/data.py +++ b/supervisor/hardware/data.py @@ -47,7 +47,7 @@ class Device: Path(udevice.device_node), Path(udevice.sys_path), udevice.subsystem, - None if not udevice.parent else Path(udevice.parent.sys_path), + None if udevice.parent is None else Path(udevice.parent.sys_path), [Path(node) for node in udevice.device_links], {attr: udevice.properties[attr] for attr in udevice.properties}, [Path(node.sys_path) for node in udevice.children], diff --git a/supervisor/store/__init__.py b/supervisor/store/__init__.py index f6839189a..7266a8f78 100644 --- a/supervisor/store/__init__.py +++ b/supervisor/store/__init__.py @@ -108,7 +108,7 @@ class StoreManager(CoreSysAttributes): self.repositories[repository.slug] = repository repos = new_rep - old_rep - tasks = [_add_repository(url) for url in repos] + tasks = [self.sys_create_task(_add_repository(url)) for url in repos] if tasks: await asyncio.wait(tasks)