Move tests folder to top level of project (#1242)

This commit is contained in:
Steven B. 2024-11-11 10:11:31 +00:00 committed by GitHub
parent e5dd874333
commit 32671da9e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
212 changed files with 97 additions and 76 deletions

View File

@ -1,7 +1,7 @@
"""This script generates devinfo files for the test suite. """This script generates devinfo files for the test suite.
If you have new, yet unsupported device or a device with no devinfo file under If you have new, yet unsupported device or a device with no devinfo file under
kasa/tests/fixtures, feel free to run this script and create a PR to add the file tests/fixtures, feel free to run this script and create a PR to add the file
to the repository. to the repository.
Executing this script will several modules and methods one by one, Executing this script will several modules and methods one by one,
@ -50,10 +50,10 @@ from kasa.smartprotocol import SmartProtocol, _ChildProtocolWrapper
Call = namedtuple("Call", "module method") Call = namedtuple("Call", "module method")
FixtureResult = namedtuple("FixtureResult", "filename, folder, data") FixtureResult = namedtuple("FixtureResult", "filename, folder, data")
SMART_FOLDER = "kasa/tests/fixtures/smart/" SMART_FOLDER = "tests/fixtures/smart/"
SMARTCAMERA_FOLDER = "kasa/tests/fixtures/smartcamera/" SMARTCAMERA_FOLDER = "tests/fixtures/smartcamera/"
SMART_CHILD_FOLDER = "kasa/tests/fixtures/smart/child/" SMART_CHILD_FOLDER = "tests/fixtures/smart/child/"
IOT_FOLDER = "kasa/tests/fixtures/" IOT_FOLDER = "tests/fixtures/"
ENCRYPT_TYPES = [encrypt_type.value for encrypt_type in DeviceEncryptionType] ENCRYPT_TYPES = [encrypt_type.value for encrypt_type in DeviceEncryptionType]

View File

@ -41,8 +41,8 @@ DEVICE_TYPE_TO_PRODUCT_GROUP = {
SUPPORTED_FILENAME = "SUPPORTED.md" SUPPORTED_FILENAME = "SUPPORTED.md"
README_FILENAME = "README.md" README_FILENAME = "README.md"
IOT_FOLDER = "kasa/tests/fixtures/" IOT_FOLDER = "tests/fixtures/"
SMART_FOLDER = "kasa/tests/fixtures/smart/" SMART_FOLDER = "tests/fixtures/smart/"
def generate_supported(args): def generate_supported(args):

View File

@ -59,7 +59,7 @@ One of the easiest ways to contribute is by creating a fixture file and uploadin
These files will help us to improve the library and run tests against devices that we have no access to. These files will help us to improve the library and run tests against devices that we have no access to.
This library is tested against responses from real devices ("fixture files"). This library is tested against responses from real devices ("fixture files").
These files contain responses for selected, known device commands and are stored [in our test suite](https://github.com/python-kasa/python-kasa/tree/master/kasa/tests/fixtures). These files contain responses for selected, known device commands and are stored [in our test suite](https://github.com/python-kasa/python-kasa/tree/master/tests/fixtures).
You can generate these files by using the `dump_devinfo.py` script. You can generate these files by using the `dump_devinfo.py` script.
Note, that this script should be run inside the main source directory so that the generated files are stored in the correct directories. Note, that this script should be run inside the main source directory so that the generated files are stored in the correct directories.

View File

@ -71,6 +71,7 @@ include = [
"/kasa", "/kasa",
"/devtools", "/devtools",
"/docs", "/docs",
"/tests",
"/CHANGELOG.md", "/CHANGELOG.md",
] ]
@ -78,15 +79,11 @@ include = [
include = [ include = [
"/kasa", "/kasa",
] ]
exclude = [
"/kasa/tests",
]
[tool.coverage.run] [tool.coverage.run]
source = ["kasa"] source = ["kasa"]
branch = true branch = true
omit = [ omit = [
"kasa/tests/*",
"kasa/experimental/*" "kasa/experimental/*"
] ]
@ -107,6 +104,9 @@ exclude_lines = [
] ]
[tool.pytest.ini_options] [tool.pytest.ini_options]
testpaths = [
"tests",
]
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",
] ]
@ -154,7 +154,7 @@ ignore = [
convention = "pep257" convention = "pep257"
[tool.ruff.lint.per-file-ignores] [tool.ruff.lint.per-file-ignores]
"kasa/tests/*.py" = [ "tests/*.py" = [
"D100", "D100",
"D101", "D101",
"D102", "D102",

View File

@ -1,9 +1,9 @@
import copy import copy
import logging import logging
from ..deviceconfig import DeviceConfig from kasa.deviceconfig import DeviceConfig
from ..iotprotocol import IotProtocol from kasa.iotprotocol import IotProtocol
from ..protocol import BaseTransport from kasa.protocol import BaseTransport
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

Some files were not shown because too many files have changed in this diff Show More