Fix pytest warnings about asyncio (#397)

Turn on ayncio auto mode for pytest and remove the global async marking flag
This commit is contained in:
Julian Davis 2022-11-13 22:34:47 +00:00 committed by GitHub
parent 9cb2a56405
commit 866c8d6db5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 9 additions and 14 deletions

View File

@ -134,10 +134,6 @@ async def handle_turn_on(dev, turn_on):
await dev.turn_off() await dev.turn_off()
# to avoid adding this for each async function separately
pytestmark = pytest.mark.asyncio
def device_for_file(model): def device_for_file(model):
for d in STRIPS: for d in STRIPS:
if d in model: if d in model:

View File

@ -10,7 +10,6 @@ from .conftest import (
non_color_bulb, non_color_bulb,
non_dimmable, non_dimmable,
non_variable_temp, non_variable_temp,
pytestmark,
turn_on, turn_on,
variable_temp, variable_temp,
) )

View File

@ -15,7 +15,7 @@ from kasa.cli import (
sysinfo, sysinfo,
) )
from .conftest import handle_turn_on, pytestmark, turn_on from .conftest import handle_turn_on, turn_on
async def test_sysinfo(dev): async def test_sysinfo(dev):

View File

@ -2,7 +2,7 @@ import pytest
from kasa import SmartDimmer from kasa import SmartDimmer
from .conftest import dimmer, handle_turn_on, pytestmark, turn_on from .conftest import dimmer, handle_turn_on, turn_on
@dimmer @dimmer

View File

@ -6,7 +6,7 @@ import pytest # type: ignore # https://github.com/pytest-dev/pytest/issues/3342
from kasa import DeviceType, Discover, SmartDevice, SmartDeviceException, protocol from kasa import DeviceType, Discover, SmartDevice, SmartDeviceException, protocol
from kasa.discover import _DiscoverProtocol from kasa.discover import _DiscoverProtocol
from .conftest import bulb, dimmer, lightstrip, plug, pytestmark, strip from .conftest import bulb, dimmer, lightstrip, plug, strip
@plug @plug

View File

@ -2,7 +2,7 @@ import pytest
from kasa import EmeterStatus, SmartDeviceException from kasa import EmeterStatus, SmartDeviceException
from .conftest import has_emeter, no_emeter, pytestmark from .conftest import has_emeter, no_emeter
from .newfakes import CURRENT_CONSUMPTION_SCHEMA from .newfakes import CURRENT_CONSUMPTION_SCHEMA

View File

@ -3,7 +3,7 @@ import pytest
from kasa import DeviceType, SmartLightStrip from kasa import DeviceType, SmartLightStrip
from kasa.exceptions import SmartDeviceException from kasa.exceptions import SmartDeviceException
from .conftest import lightstrip, pytestmark from .conftest import lightstrip
@lightstrip @lightstrip

View File

@ -1,6 +1,6 @@
from kasa import DeviceType from kasa import DeviceType
from .conftest import plug, pytestmark from .conftest import plug
from .newfakes import PLUG_SCHEMA from .newfakes import PLUG_SCHEMA

View File

@ -8,7 +8,6 @@ import pytest
from ..exceptions import SmartDeviceException from ..exceptions import SmartDeviceException
from ..protocol import TPLinkSmartHomeProtocol from ..protocol import TPLinkSmartHomeProtocol
from .conftest import pytestmark
@pytest.mark.parametrize("retry_count", [1, 3, 5]) @pytest.mark.parametrize("retry_count", [1, 3, 5])

View File

@ -6,7 +6,7 @@ import pytest # type: ignore # https://github.com/pytest-dev/pytest/issues/3342
from kasa import SmartDeviceException from kasa import SmartDeviceException
from kasa.smartstrip import SmartStripPlug from kasa.smartstrip import SmartStripPlug
from .conftest import handle_turn_on, has_emeter, no_emeter, pytestmark, turn_on from .conftest import handle_turn_on, has_emeter, no_emeter, turn_on
from .newfakes import PLUG_SCHEMA, TZ_SCHEMA, FakeTransportProtocol from .newfakes import PLUG_SCHEMA, TZ_SCHEMA, FakeTransportProtocol

View File

@ -4,7 +4,7 @@ import pytest
from kasa import SmartDeviceException, SmartStrip from kasa import SmartDeviceException, SmartStrip
from .conftest import handle_turn_on, pytestmark, strip, turn_on from .conftest import handle_turn_on, strip, turn_on
@strip @strip

View File

@ -80,6 +80,7 @@ verbose = 2
markers = [ markers = [
"requires_dummy: test requires dummy data to pass, skipped on real devices", "requires_dummy: test requires dummy data to pass, skipped on real devices",
] ]
asyncio_mode = "auto"
[tool.doc8] [tool.doc8]
paths = ["docs"] paths = ["docs"]