Skip to content

Commit

Permalink
Fix command line tools not handling stdin/stdout pipes properly
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed May 4, 2021
1 parent 5fd122c commit 8300994
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions tests/tools/test_network_backup_restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
CoroutineMock,
BaseZStack1CC2531,
BaseZStack3CC2531,
FormedZStack1CC2531,
BaseLaunchpadCC26X2R1,
)
from ..application.test_startup import DEV_NETWORK_SETTINGS
Expand Down Expand Up @@ -118,6 +119,17 @@ async def test_network_backup_empty(device, make_znp_server):
await network_backup([znp_server._port_path, "-o", "-"])


@pytest.mark.parametrize("device", [FormedZStack1CC2531])
@pytest.mark.asyncio
async def test_network_backup_pipe(device, make_znp_server, capsys):
znp_server = make_znp_server(server_cls=device)

await network_backup([znp_server._port_path, "-o", "-"])
stdout, stderr = capsys.readouterr()

validate_backup_json(json.loads(stdout))


@pytest.mark.parametrize("device", FORMED_DEVICES)
@pytest.mark.asyncio
async def test_network_backup_formed(device, make_znp_server, tmp_path):
Expand Down
2 changes: 1 addition & 1 deletion zigpy_znp/tools/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def close(self):
return

def __enter__(self):
return
return self

def __exit__(self, exc_type, exc_value, traceback):
return
Expand Down

0 comments on commit 8300994

Please sign in to comment.