Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions moler/io/raw/terminal_no_fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def __init__(
:param terminal_delayafterclose: delay for checking if terminal was properly closed
"""
super().__init__(moler_connection=moler_connection)
self.logger.warning("ThreadedTerminalNoFork - experimental implementation. Use at your own risk.")
self.debug_hex_on_non_printable_chars = (
False # Set True to log incoming non printable chars as hex.
)
Expand Down
24 changes: 24 additions & 0 deletions test/integration/test_io_raw_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from moler.cmd.unix.ping import Ping
from moler.cmd.unix.whoami import Whoami
from moler.cmd.unix.lsof import Lsof
from moler.cmd.unix.touch import Touch
from moler.cmd.unix.rm import Rm
from moler.exceptions import CommandTimeout
from moler.io.raw.terminal import ThreadedTerminal
from moler.io.raw.terminal_no_fork import ThreadedTerminalNoFork
Expand Down Expand Up @@ -84,6 +86,28 @@ def test_terminal_lsof(terminal_connection):
assert ret["NUMBER"] > 1


def test_terminal_touch(terminal_connection):
import os
import tempfile
terminal = terminal_connection
test_file = tempfile.mktemp(suffix='.txt')
test_file_name = os.path.basename(test_file)
test_file_dir = os.path.dirname(test_file) or '.'
try:
cmd = Touch(connection=terminal, path=test_file)
cmd()
assert os.path.exists(test_file)
cmd_ls = Ls(connection=terminal, path=test_file_dir)
ret = cmd_ls()
assert test_file_name in ret['files']
cmd_rm = Rm(connection=terminal, file=test_file)
cmd_rm()
assert not os.path.exists(test_file)
finally:
if os.path.exists(test_file):
os.remove(test_file)


@pytest.fixture(params=[ThreadedTerminal, ThreadedTerminalNoFork])
def terminal_connection(request):
from moler.threaded_moler_connection import ThreadedMolerConnection
Expand Down