mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 11:13:34 +00:00
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:
parent
9cb2a56405
commit
866c8d6db5
@ -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:
|
||||||
|
@ -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,
|
||||||
)
|
)
|
||||||
|
@ -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):
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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])
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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"]
|
||||||
|
Loading…
Reference in New Issue
Block a user