mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-22 19:23:34 +00:00
Drop python 3.7 support (#455)
* Drop python 3.7 support * CI: drop 3.7 and add 3.11 * Remove skipifs that were required for <3.8 * Use pypy-3.8 for CI, re-enable pypy for windows to see if it works now * Bump readthedocs to use py3.8 * Remove py3.7 failure comment
This commit is contained in:
parent
e7b7f1de94
commit
ce5821a35f
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.10"]
|
python-version: ["3.11"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v2"
|
- uses: "actions/checkout@v2"
|
||||||
@ -64,14 +64,14 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7"]
|
python-version: ["3.8", "3.9", "3.10", "3.11", "pypy-3.8"]
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
# exclude pypy on windows, as the poetry install seems to be very flaky:
|
# exclude pypy on windows, as the poetry install seems to be very flaky:
|
||||||
# PermissionError(13, 'The process cannot access the file because it is being used by another process'))
|
# PermissionError(13, 'The process cannot access the file because it is being used by another process'))
|
||||||
# at C:\hostedtoolcache\windows\PyPy\3.7.10\x86\site-packages\requests\models.py:761 in generate
|
# at C:\hostedtoolcache\windows\PyPy\3.7.10\x86\site-packages\requests\models.py:761 in generate
|
||||||
exclude:
|
# exclude:
|
||||||
- python-version: pypy-3.7
|
# - python-version: pypy-3.8
|
||||||
os: windows-latest
|
# os: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: "actions/checkout@v2"
|
- uses: "actions/checkout@v2"
|
||||||
|
@ -13,7 +13,7 @@ repos:
|
|||||||
rev: v3.4.0
|
rev: v3.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ['--py37-plus']
|
args: ['--py38-plus']
|
||||||
|
|
||||||
- repo: https://github.com/python/black
|
- repo: https://github.com/python/black
|
||||||
rev: 23.3.0
|
rev: 23.3.0
|
||||||
|
@ -2,7 +2,7 @@ build:
|
|||||||
image: latest
|
image: latest
|
||||||
|
|
||||||
python:
|
python:
|
||||||
version: 3.7
|
version: 3.8
|
||||||
pip_install: true
|
pip_install: true
|
||||||
extra_requirements:
|
extra_requirements:
|
||||||
- docs
|
- docs
|
||||||
|
@ -60,7 +60,6 @@ async def test_raw_command(dev):
|
|||||||
assert "Usage" in res.output
|
assert "Usage" in res.output
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="3.8 is first one with asyncmock")
|
|
||||||
async def test_emeter(dev: SmartDevice, mocker):
|
async def test_emeter(dev: SmartDevice, mocker):
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
|
|
||||||
@ -103,9 +102,6 @@ async def test_brightness(dev):
|
|||||||
assert "Brightness: 12" in res.output
|
assert "Brightness: 12" in res.output
|
||||||
|
|
||||||
|
|
||||||
# Invoke fails when run on py3.7 with the following error:
|
|
||||||
# E + where 1 = <Result TypeError("object list can't be used in 'await' expression")>.exit_code
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="fails on python3.7")
|
|
||||||
async def test_json_output(dev: SmartDevice, mocker):
|
async def test_json_output(dev: SmartDevice, mocker):
|
||||||
"""Test that the json output produces correct output."""
|
"""Test that the json output produces correct output."""
|
||||||
mocker.patch("kasa.Discover.discover", return_value=[dev])
|
mocker.patch("kasa.Discover.discover", return_value=[dev])
|
||||||
|
@ -52,7 +52,6 @@ async def test_type_unknown():
|
|||||||
Discover._get_device_class(invalid_info)
|
Discover._get_device_class(invalid_info)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="3.8 is first one with asyncmock")
|
|
||||||
async def test_discover_single(discovery_data: dict, mocker):
|
async def test_discover_single(discovery_data: dict, mocker):
|
||||||
"""Make sure that discover_single returns an initialized SmartDevice instance."""
|
"""Make sure that discover_single returns an initialized SmartDevice instance."""
|
||||||
mocker.patch("kasa.TPLinkSmartHomeProtocol.query", return_value=discovery_data)
|
mocker.patch("kasa.TPLinkSmartHomeProtocol.query", return_value=discovery_data)
|
||||||
@ -71,7 +70,6 @@ INVALIDS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="3.8 is first one with asyncmock")
|
|
||||||
@pytest.mark.parametrize("msg, data", INVALIDS)
|
@pytest.mark.parametrize("msg, data", INVALIDS)
|
||||||
async def test_discover_invalid_info(msg, data, mocker):
|
async def test_discover_invalid_info(msg, data, mocker):
|
||||||
"""Make sure that invalid discovery information raises an exception."""
|
"""Make sure that invalid discovery information raises an exception."""
|
||||||
|
@ -62,7 +62,6 @@ async def test_protocol_retry_recoverable_error(mocker):
|
|||||||
assert conn.call_count == 6
|
assert conn.call_count == 6
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="3.8 is first one with asyncmock")
|
|
||||||
@pytest.mark.parametrize("retry_count", [1, 3, 5])
|
@pytest.mark.parametrize("retry_count", [1, 3, 5])
|
||||||
async def test_protocol_reconnect(mocker, retry_count):
|
async def test_protocol_reconnect(mocker, retry_count):
|
||||||
remaining = retry_count
|
remaining = retry_count
|
||||||
@ -98,7 +97,6 @@ async def test_protocol_reconnect(mocker, retry_count):
|
|||||||
assert response == {"great": "success"}
|
assert response == {"great": "success"}
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="3.8 is first one with asyncmock")
|
|
||||||
@pytest.mark.parametrize("log_level", [logging.WARNING, logging.DEBUG])
|
@pytest.mark.parametrize("log_level", [logging.WARNING, logging.DEBUG])
|
||||||
async def test_protocol_logging(mocker, caplog, log_level):
|
async def test_protocol_logging(mocker, caplog, log_level):
|
||||||
caplog.set_level(log_level)
|
caplog.set_level(log_level)
|
||||||
|
@ -61,15 +61,10 @@ def test_lightstrip_examples(mocker):
|
|||||||
assert not res["failed"]
|
assert not res["failed"]
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
sys.version_info < (3, 8), reason="3.7 handles asyncio.run differently"
|
|
||||||
)
|
|
||||||
def test_discovery_examples(mocker):
|
def test_discovery_examples(mocker):
|
||||||
"""Test discovery examples."""
|
"""Test discovery examples."""
|
||||||
p = asyncio.run(get_device_for_file("KP303(UK)_1.0_1.0.3.json"))
|
p = asyncio.run(get_device_for_file("KP303(UK)_1.0_1.0.3.json"))
|
||||||
|
|
||||||
# This succeeds on python 3.8 but fails on 3.7
|
|
||||||
# ValueError: a coroutine was expected, got [<DeviceType.Strip model KP303(UK) ...
|
|
||||||
mocker.patch("kasa.discover.Discover.discover", return_value=[p])
|
mocker.patch("kasa.discover.Discover.discover", return_value=[p])
|
||||||
res = xdoctest.doctest_module("kasa.discover", "all")
|
res = xdoctest.doctest_module("kasa.discover", "all")
|
||||||
assert not res["failed"]
|
assert not res["failed"]
|
||||||
|
@ -19,7 +19,7 @@ include = ["CHANGELOG.md"]
|
|||||||
kasa = "kasa.cli:cli"
|
kasa = "kasa.cli:cli"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "^3.7"
|
python = "^3.8"
|
||||||
anyio = "*" # see https://github.com/python-trio/asyncclick/issues/18
|
anyio = "*" # see https://github.com/python-trio/asyncclick/issues/18
|
||||||
importlib-metadata = "*"
|
importlib-metadata = "*"
|
||||||
asyncclick = ">=8"
|
asyncclick = ">=8"
|
||||||
|
Loading…
Reference in New Issue
Block a user