diff options
| -rw-r--r-- | test/fs.py | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -451,6 +451,21 @@ def exit_answers(binary): raise AssertionError("Exit did not quit the editor") +def unattended_messages_expire(binary): + """With nothing attached, a message leaves after MessageLinger on its own + clock: no key, no click, no other request comes to move it along.""" + with tempfile.TemporaryDirectory(prefix='pardes-msg-') as directory: + with session(binary, Path(directory), 'msg') as (client, _): + client.write('/pane/1/ctl', b'Msg lingering-words\n') + def shown(): + screen = json.loads(client.read('/screen')) + return 'lingering-words' in ''.join(cell[0] for cell in screen['cells']) + assert shown() + # Reading /screen is itself a request, so wait without asking. + time.sleep(2.5) + assert not shown(), 'an unattended message outlived MessageLinger' + + def signal_cleans_up(binary): """A detached session told to stop by a signal unlinks its sockets.""" for sig in [signal.SIGTERM, signal.SIGINT, signal.SIGHUP]: @@ -471,6 +486,7 @@ def test(binary, quic=False): started = time.monotonic() run_file(binary) exit_answers(binary) + unattended_messages_expire(binary) signal_cleans_up(binary) for options, message in [ (['--fs'], b'no such option'), |
