Remove experimental support (#1256)

This commit is contained in:
Steven B.
2024-11-14 14:55:02 +00:00
committed by GitHub
parent 6213b90f62
commit b8f6651d9b
6 changed files with 5 additions and 100 deletions

View File

@@ -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