8000 Structure cli into a package by sdb9696 · Pull Request #1038 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Structure cli into a package #1038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devtools/parse_pcap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import dpkt
from dpkt.ethernet import ETH_TYPE_IP, Ethernet

from kasa.cli import echo
from kasa.cli.main import echo
from kasa.xortransport import XorEncryption


Expand Down
1 change: 1 addition & 0 deletions kasa/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Package for the cli."""
5 changes: 5 additions & 0 deletions kasa/cli/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Main module."""

from kasa.cli.main import cli

Check warning on line 3 in kasa/cli/__main__.py

View check run for this annotation

Codecov / codecov/patch

kasa/cli/__main__.py#L3

Added line #L3 was not covered by tests

cli()

Check warning on line 5 in kasa/cli/__main__.py

View check run for this annotation

Codecov / codecov/patch

kasa/cli/__main__.py#L5

Added line #L5 was not covered by tests
File renamed without changes.
6 changes: 3 additions & 3 deletions kasa/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Module,
UnsupportedDeviceError,
)
from kasa.cli import (
from kasa.cli.main import (
TYPE_TO_CLASS,
alias,
brightness,
Expand Down Expand Up @@ -500,7 +500,7 @@ async def _state(dev: Device):
f"Username:{dev.credentials.username} Password:{dev.credentials.password}"
)

mocker.patch("kasa.cli.state", new=_state)
mocker.patch("kasa.cli.main.state", new=_state)

dr = DiscoveryResult(**discovery_mock.discovery_data["result"])
res = await runner.invoke(
Expand Down Expand Up @@ -746,7 +746,7 @@ async def _state(dev: Device):
nonlocal result_device
result_device = dev

mocker.patch("kasa.cli.state", new=_state)
mocker.patch("kasa.cli.main.state", new=_state)
expected_type = TYPE_TO_CLASS[device_type]
mocker.patch.object(expected_type, "update")
res = await runner.invoke(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
6641
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ include = [
"Documentation" = "https://python-kasa.readthedocs.io"

[tool.poetry.scripts]
kasa = "kasa.cli:cli"
kasa = "kasa.cli:__main__"

[tool.poetry.dependencies]
python = "^3.9"
Expand Down
Loading
0