mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-06 10:44:04 +00:00
Add 'shell' command to cli (#738)
* Add 'shell' command to cli * Add test * Add ptpython as optional dep
This commit is contained in:
@@ -558,3 +558,21 @@ async def test_type_param(device_type, mocker):
|
||||
)
|
||||
assert res.exit_code == 0
|
||||
assert isinstance(result_device, expected_type)
|
||||
|
||||
|
||||
@pytest.mark.skip(
|
||||
"Skip until pytest-asyncio supports pytest 8.0, https://github.com/pytest-dev/pytest-asyncio/issues/737"
|
||||
)
|
||||
async def test_shell(dev: Device, mocker):
|
||||
"""Test that the shell commands tries to embed a shell."""
|
||||
mocker.patch("kasa.Discover.discover", return_value=[dev])
|
||||
# repl = mocker.patch("ptpython.repl")
|
||||
mocker.patch.dict(
|
||||
"sys.modules",
|
||||
{"ptpython": mocker.MagicMock(), "ptpython.repl": mocker.MagicMock()},
|
||||
)
|
||||
embed = mocker.patch("ptpython.repl.embed")
|
||||
runner = CliRunner()
|
||||
res = await runner.invoke(cli, ["shell"], obj=dev)
|
||||
assert res.exit_code == 0
|
||||
embed.assert_called()
|
||||
|
Reference in New Issue
Block a user