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
|
@ -1,6 +1,7 @@
|
|||
# Copyright (C) 2012-2021 jrnl contributors
|
||||
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
import functools
|
||||
import os
|
||||
|
||||
|
||||
|
@ -38,3 +39,13 @@ def assert_equal_tags_ignoring_order(
|
|||
[actual_tags, expected_tags],
|
||||
[expected_content, actual_content],
|
||||
]
|
||||
|
||||
|
||||
# @see: https://stackoverflow.com/a/65782539/569146
|
||||
def get_nested_val(dictionary, path, *default):
|
||||
try:
|
||||
return functools.reduce(lambda x, y: x[y], path.split("."), dictionary)
|
||||
except KeyError:
|
||||
if default:
|
||||
return default[0]
|
||||
raise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue