From af0a1d61b1acf982c64b981d5f0d5dea302c8dd0 Mon Sep 17 00:00:00 2001 From: Bas Nijholt Date: Mon, 11 Nov 2019 17:03:45 +0100 Subject: [PATCH] use asyncio.run in tests instead of awaiting --- pyHS100/tests/conftest.py | 3 ++- pyHS100/tests/test_fixtures.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyHS100/tests/conftest.py b/pyHS100/tests/conftest.py index 7a237c3b..ccb4fd73 100644 --- a/pyHS100/tests/conftest.py +++ b/pyHS100/tests/conftest.py @@ -1,3 +1,4 @@ +import asyncio import pytest import glob import json @@ -76,7 +77,7 @@ def dev(request): ip = request.config.getoption("--ip") if ip: - d = Discover.discover_single(ip) + d = asyncio.run(Discover.discover_single(ip)) print(d.model) if d.model in file: return d diff --git a/pyHS100/tests/test_fixtures.py b/pyHS100/tests/test_fixtures.py index e33cb24d..9cb80ab7 100644 --- a/pyHS100/tests/test_fixtures.py +++ b/pyHS100/tests/test_fixtures.py @@ -1,3 +1,4 @@ +import asyncio import datetime from unittest.mock import patch @@ -63,7 +64,7 @@ def test_invalid_connection(dev): def test_query_helper(dev): with pytest.raises(SmartDeviceException): - dev._query_helper("test", "testcmd", {}) + asyncio.run(dev._query_helper("test", "testcmd", {})) # TODO check for unwrapping?