Skip to content

Commit

Permalink
Unignore F401 for tests (#724)
Browse files Browse the repository at this point in the history
* Unignore F401 for tests

* Fix linting
  • Loading branch information
rytilahti committed Jan 29, 2024
1 parent 9e6896a commit 55525fc
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 44 deletions.
4 changes: 2 additions & 2 deletions kasa/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from dataclasses import dataclass
from json import dumps as json_dumps
from os.path import basename
from pathlib import Path, PurePath
from typing import Dict, Optional, Set
from pathlib import Path
from typing import Dict, Optional
from unittest.mock import MagicMock

import pytest # type: ignore # see https://github.com/pytest-dev/pytest/issues/3342
Expand Down
4 changes: 1 addition & 3 deletions kasa/tests/test_aestransport.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from contextlib import nullcontext as does_not_raise
from json import dumps as json_dumps
from json import loads as json_loads
from typing import Any, Dict, Optional
from typing import Any, Dict

import aiohttp
import pytest
Expand All @@ -18,8 +18,6 @@
from ..credentials import Credentials
from ..deviceconfig import DeviceConfig
from ..exceptions import (
SMART_RETRYABLE_ERRORS,
SMART_TIMEOUT_ERRORS,
AuthenticationException,
SmartDeviceException,
SmartErrorCode,
Expand Down
4 changes: 0 additions & 4 deletions kasa/tests/test_bulb.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import pytest
from voluptuous import (
REMOVE_EXTRA,
All,
Any,
Boolean,
Coerce, # type: ignore
Invalid,
Optional,
Range,
Schema,
Expand Down
1 change: 0 additions & 1 deletion kasa/tests/test_childdevice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from kasa.smartprotocol import _ChildProtocolWrapper
from kasa.tapo import ChildDevice

from .conftest import strip_smart

Expand Down
2 changes: 0 additions & 2 deletions kasa/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from kasa import (
AuthenticationException,
Credentials,
EmeterStatus,
SmartDevice,
SmartDeviceException,
Expand All @@ -28,7 +27,6 @@
wifi,
)
from kasa.discover import Discover, DiscoveryResult
from kasa.smartprotocol import SmartProtocol

from .conftest import device_iot, device_smart, handle_turn_on, new_discovery, turn_on

Expand Down
6 changes: 0 additions & 6 deletions kasa/tests/test_device_factory.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
# type: ignore
import logging
from typing import Type

import aiohttp
import pytest # type: ignore # https://github.com/pytest-dev/pytest/issues/3342

from kasa import (
Credentials,
DeviceType,
Discover,
SmartBulb,
SmartDevice,
SmartDeviceException,
SmartDimmer,
SmartLightStrip,
SmartPlug,
)
from kasa.device_factory import connect, get_protocol
from kasa.deviceconfig import (
Expand Down
3 changes: 0 additions & 3 deletions kasa/tests/test_deviceconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

from kasa.credentials import Credentials
from kasa.deviceconfig import (
ConnectionType,
DeviceConfig,
DeviceFamilyType,
EncryptType,
)
from kasa.exceptions import SmartDeviceException

Expand Down
6 changes: 0 additions & 6 deletions kasa/tests/test_discovery.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# type: ignore
import asyncio
import logging
import re
import socket
from unittest.mock import MagicMock
Expand All @@ -15,26 +14,21 @@
Discover,
SmartDevice,
SmartDeviceException,
protocol,
)
from kasa.deviceconfig import (
ConnectionType,
DeviceConfig,
DeviceFamilyType,
EncryptType,
)
from kasa.discover import DiscoveryResult, _DiscoverProtocol, json_dumps
from kasa.exceptions import AuthenticationException, UnsupportedDeviceException
from kasa.xortransport import XorEncryption

from .conftest import (
bulb,
bulb_iot,
dimmer,
lightstrip,
new_discovery,
plug,
strip,
strip_iot,
)

Expand Down
3 changes: 0 additions & 3 deletions kasa/tests/test_emeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@

import pytest
from voluptuous import (
REMOVE_EXTRA,
All,
Any,
Coerce, # type: ignore
Invalid,
Optional,
Range,
Schema,
)
Expand Down
4 changes: 0 additions & 4 deletions kasa/tests/test_klapprotocol.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import errno
import json
import logging
import secrets
import struct
import sys
import time
from contextlib import nullcontext as does_not_raise
from unittest.mock import PropertyMock

import aiohttp
import pytest
Expand Down
2 changes: 0 additions & 2 deletions kasa/tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,6 @@ def test_decrypt_unicode(decrypt_class):


def _get_subclasses(of_class):
import kasa

package = sys.modules["kasa"]
subclasses = set()
for _, modname, _ in pkgutil.iter_modules(package.__path__):
Expand Down
2 changes: 0 additions & 2 deletions kasa/tests/test_readme_examples.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import asyncio
import sys

import pytest
import xdoctest

from kasa.tests.conftest import get_device_for_file
Expand Down
4 changes: 1 addition & 3 deletions kasa/tests/test_smartprotocol.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from itertools import chain
from typing import Dict

import pytest

Expand All @@ -11,8 +10,7 @@
SmartDeviceException,
SmartErrorCode,
)
from ..protocol import BaseTransport
from ..smartprotocol import SmartProtocol, _ChildProtocolWrapper
from ..smartprotocol import _ChildProtocolWrapper

DUMMY_QUERY = {"foobar": {"foo": "bar", "bar": "foo"}}
DUMMY_MULTIPLE_QUERY = {
Expand Down
2 changes: 0 additions & 2 deletions kasa/tests/test_usage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import datetime
from unittest.mock import Mock

import pytest

from kasa.modules import Usage


Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ convention = "pep257"
"D102",
"D103",
"D104",
"F401",
"S101", # allow asserts
"E501", # ignore line-too-longs
]
Expand Down

0 comments on commit 55525fc

Please sign in to comment.