diff --git a/moler/io/raw/terminal_no_fork.py b/moler/io/raw/terminal_no_fork.py index 2bb12132e..83d8e85ac 100644 --- a/moler/io/raw/terminal_no_fork.py +++ b/moler/io/raw/terminal_no_fork.py @@ -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. ) diff --git a/test/integration/test_io_raw_terminal.py b/test/integration/test_io_raw_terminal.py index bf89abd10..3536581a0 100644 --- a/test/integration/test_io_raw_terminal.py +++ b/test/integration/test_io_raw_terminal.py @@ -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 @@ -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