mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-12 09:56:14 +02:00
Add config overrides steps to pytest
This requires some patching around the config object, which now happens in every test. Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
e16e3a1f62
commit
9cd2250a61
8 changed files with 138 additions and 39 deletions
|
@ -34,6 +34,7 @@ def when_we_change_directory(directory_name):
|
|||
def we_run(
|
||||
command,
|
||||
config_path,
|
||||
config_in_memory,
|
||||
user_input,
|
||||
cli_run,
|
||||
capsys,
|
||||
|
@ -63,7 +64,19 @@ def we_run(
|
|||
password = user_input
|
||||
|
||||
with ExitStack() as stack:
|
||||
# Always mock
|
||||
from jrnl.override import apply_overrides
|
||||
|
||||
def my_overrides(*args, **kwargs):
|
||||
result = apply_overrides(*args, **kwargs)
|
||||
config_in_memory["overrides"] = result
|
||||
return result
|
||||
|
||||
stack.enter_context(
|
||||
patch("jrnl.jrnl.apply_overrides", side_effect=my_overrides)
|
||||
)
|
||||
|
||||
# Conditionally mock
|
||||
stack.enter_context(patch("sys.argv", ["jrnl"] + args))
|
||||
|
||||
mock_stdin = stack.enter_context(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue