mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-07 00:36:13 +02:00
update datetime tests
This commit is contained in:
parent
e5c1114ca2
commit
379a63c8f1
3 changed files with 91 additions and 24 deletions
|
@ -5,6 +5,22 @@ from jrnl.os_compat import on_windows
|
|||
|
||||
CWD = os.getcwd()
|
||||
|
||||
# @see https://behave.readthedocs.io/en/latest/tutorial.html#debug-on-error-in-case-of-step-failures
|
||||
BEHAVE_DEBUG_ON_ERROR = False
|
||||
|
||||
def setup_debug_on_error(userdata):
|
||||
global BEHAVE_DEBUG_ON_ERROR
|
||||
BEHAVE_DEBUG_ON_ERROR = userdata.getbool("BEHAVE_DEBUG_ON_ERROR")
|
||||
|
||||
def before_all(context):
|
||||
setup_debug_on_error(context.config.userdata)
|
||||
|
||||
# def after_step(context, step):
|
||||
# if BEHAVE_DEBUG_ON_ERROR and step.status == "failed":
|
||||
# -- ENTER DEBUGGER: Zoom in on failure location.
|
||||
# NOTE: Use IPython debugger, same for pdb (basic python debugger).
|
||||
# import ipdb
|
||||
# ipdb.post_mortem(step.exc_traceback)
|
||||
|
||||
def clean_all_working_dirs():
|
||||
if os.path.exists("test.txt"):
|
||||
|
@ -58,4 +74,8 @@ def after_scenario(context, scenario):
|
|||
"""After each scenario, restore all test data and remove working_dirs."""
|
||||
if os.getcwd() != CWD:
|
||||
os.chdir(CWD)
|
||||
clean_all_working_dirs()
|
||||
|
||||
# only clean up if debugging is off and the scenario passed
|
||||
if not BEHAVE_DEBUG_ON_ERROR and scenario.status != "failed":
|
||||
clean_all_working_dirs()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue