From: martin f. krafft Date: Sun, 3 Sep 2023 20:23:51 +0000 (+0200) Subject: buildmimetree.py: housekeeping at the end of commands X-Git-Url: https://git.madduck.net/etc/neomutt.git/commitdiff_plain/a16bc88689b1f87923bd55bc2bb2d2d172b89eaf?ds=sidebyside buildmimetree.py: housekeeping at the end of commands --- diff --git a/.config/neomutt/buildmimetree.py b/.config/neomutt/buildmimetree.py index 2ad671a..f5e3c17 100755 --- a/.config/neomutt/buildmimetree.py +++ b/.config/neomutt/buildmimetree.py @@ -958,14 +958,6 @@ def do_massage( # variable used to identify the command file we're currently writing # to. cmds = MuttCommands(cmd_f, debug=debug_commands) - cmds.cmd('set editor="$my_editor"') - cmds.cmd('set edit_headers="$my_edit_headers"') - cmds.cmd("unset my_editor") - cmds.cmd("unset my_edit_headers") - - # let's flush those commands, as there'll be a lot of pushes from now - # on, which need to be run in reverse order - cmds.flush() extensions = extensions.split(",") if extensions else [] tree = converter( @@ -1111,6 +1103,10 @@ def do_massage( except AttributeError: filename = "pytest_internal_file" cmds.cmd(f"source 'rm -f {filename}|'") + cmds.cmd('set editor="$my_editor"') + cmds.cmd('set edit_headers="$my_edit_headers"') + cmds.cmd("unset my_editor") + cmds.cmd("unset my_edit_headers") cmds.cmd("unset my_mdwn_postprocess_cmd_file") cmds.flush() @@ -1405,14 +1401,14 @@ try: ) lines = cmd_f.read().splitlines() - assert '="$my_editor"' in lines.pop(0) - assert '="$my_edit_headers"' in lines.pop(0) - assert "unset my_editor" == lines.pop(0) - assert "unset my_edit_headers" == lines.pop(0) assert "send-message" in lines.pop(0) assert "update-encoding" in lines.pop(0) assert "first-entry" in lines.pop(0) assert "source 'rm -f " in lines.pop(0) + assert '="$my_editor"' in lines.pop(0) + assert '="$my_edit_headers"' in lines.pop(0) + assert "unset my_editor" == lines.pop(0) + assert "unset my_edit_headers" == lines.pop(0) assert "unset my_mdwn_postprocess_cmd_file" == lines.pop(0) @pytest.mark.massage @@ -1429,7 +1425,7 @@ try: max_other_attachments=max_attachments, converter=converter, ) - lines = cmd_f.read().splitlines()[4:-2] + lines = cmd_f.read().splitlines()[:-6] assert "first-entry" in lines.pop() assert "update-encoding" in lines.pop() @@ -1471,7 +1467,7 @@ try: cmd_f=cmd_f, converter=converter, ) - lines = cmd_f.read().splitlines()[4:-2] + lines = cmd_f.read().splitlines()[:-6] assert "first-entry" in lines.pop() assert "update-encoding" in lines.pop()