mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 13:08:31 +02:00
Fix editor test that needed patched config and trapping for system exit
This commit is contained in:
parent
80072b5b3d
commit
91049eda6c
1 changed files with 9 additions and 2 deletions
|
@ -194,11 +194,18 @@ def open_editor_and_enter(context, method, text=""):
|
||||||
with \
|
with \
|
||||||
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
patch("subprocess.call", side_effect=_mock_editor) as mock_editor, \
|
||||||
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
patch("getpass.getpass", side_effect=_mock_getpass(password)) as mock_getpass, \
|
||||||
patch("sys.stdin.isatty", return_value=True) \
|
patch("sys.stdin.isatty", return_value=True), \
|
||||||
|
patch("jrnl.config.get_config_path", side_effect=lambda: context.config_path), \
|
||||||
|
patch("jrnl.install.get_config_path", side_effect=lambda: context.config_path) \
|
||||||
:
|
:
|
||||||
context.editor = mock_editor
|
context.editor = mock_editor
|
||||||
context.getpass = mock_getpass
|
context.getpass = mock_getpass
|
||||||
|
try:
|
||||||
cli(["--edit"])
|
cli(["--edit"])
|
||||||
|
context.exit_status = 0
|
||||||
|
except SystemExit as e:
|
||||||
|
context.exit_status = e.code
|
||||||
|
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue