mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Remove experimental support (#1256)
This commit is contained in:
@@ -861,9 +861,6 @@ async def test_host_auth_failed(discovery_mock, mocker, runner):
|
||||
@pytest.mark.parametrize("device_type", TYPES)
|
||||
async def test_type_param(device_type, mocker, runner):
|
||||
"""Test for handling only one of username or password supplied."""
|
||||
if device_type == "camera":
|
||||
pytest.skip(reason="camera is experimental")
|
||||
|
||||
result_device = FileNotFoundError
|
||||
pass_dev = click.make_pass_decorator(Device)
|
||||
|
||||
@@ -873,7 +870,9 @@ async def test_type_param(device_type, mocker, runner):
|
||||
result_device = dev
|
||||
|
||||
mocker.patch("kasa.cli.device.state", new=_state)
|
||||
if device_type == "smart":
|
||||
if device_type == "camera":
|
||||
expected_type = SmartCamera
|
||||
elif device_type == "smart":
|
||||
expected_type = SmartDevice
|
||||
else:
|
||||
expected_type = _legacy_type_to_class(device_type)
|
||||
@@ -1253,39 +1252,3 @@ async def test_discover_config_invalid(mocker, runner):
|
||||
)
|
||||
assert res.exit_code == 1
|
||||
assert "--target is not a valid option for single host discovery" in res.output
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("option", "env_var_value", "expectation"),
|
||||
[
|
||||
pytest.param("--experimental", None, True),
|
||||
pytest.param("--experimental", "false", True),
|
||||
pytest.param(None, None, False),
|
||||
pytest.param(None, "true", True),
|
||||
pytest.param(None, "false", False),
|
||||
pytest.param("--no-experimental", "true", False),
|
||||
],
|
||||
)
|
||||
async def test_experimental_flags(mocker, option, env_var_value, expectation):
|
||||
"""Test the experimental flag is set correctly."""
|
||||
mocker.patch("kasa.discover.Discover.try_connect_all", return_value=None)
|
||||
|
||||
# reset the class internal variable
|
||||
from kasa.experimental import Experimental
|
||||
|
||||
Experimental._enabled = None
|
||||
|
||||
KASA_VARS = {k: None for k, v in os.environ.items() if k.startswith("KASA_")}
|
||||
if env_var_value:
|
||||
KASA_VARS["KASA_EXPERIMENTAL"] = env_var_value
|
||||
args = [
|
||||
"--host",
|
||||
"127.0.0.2",
|
||||
"discover",
|
||||
"config",
|
||||
]
|
||||
if option:
|
||||
args.insert(0, option)
|
||||
runner = CliRunner(env=KASA_VARS)
|
||||
res = await runner.invoke(cli, args)
|
||||
assert ("Experimental support is enabled" in res.output) is expectation
|
||||
|
Reference in New Issue
Block a user