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)
This commit is contained in:
Stefan Agner 2021-12-14 16:30:22 +01:00 committed by GitHub
parent 050851a9ac
commit cde45e2e7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ class Device:
Path(udevice.device_node), Path(udevice.device_node),
Path(udevice.sys_path), Path(udevice.sys_path),
udevice.subsystem, 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], [Path(node) for node in udevice.device_links],
{attr: udevice.properties[attr] for attr in udevice.properties}, {attr: udevice.properties[attr] for attr in udevice.properties},
[Path(node.sys_path) for node in udevice.children], [Path(node.sys_path) for node in udevice.children],

View File

@ -108,7 +108,7 @@ class StoreManager(CoreSysAttributes):
self.repositories[repository.slug] = repository self.repositories[repository.slug] = repository
repos = new_rep - old_rep 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: if tasks:
await asyncio.wait(tasks) await asyncio.wait(tasks)