mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 13:36:14 +02:00
Tests for using stderr prompts
This commit is contained in:
parent
d3edbfd53b
commit
279547c350
4 changed files with 17 additions and 4 deletions
|
@ -1,9 +1,16 @@
|
|||
from behave import *
|
||||
import shutil
|
||||
import os
|
||||
from jrnl import jrnl
|
||||
try:
|
||||
from io import StringIO
|
||||
except ImportError:
|
||||
from cStringIO import StringIO
|
||||
|
||||
def before_scenario(context, scenario):
|
||||
"""Before each scenario, backup all config and journal test data."""
|
||||
context.messages = StringIO()
|
||||
jrnl.util.STDERR = context.messages
|
||||
for folder in ("configs", "journals"):
|
||||
original = os.path.join("features", folder)
|
||||
backup = os.path.join("features", folder+"_backup")
|
||||
|
@ -14,6 +21,8 @@ def before_scenario(context, scenario):
|
|||
|
||||
def after_scenario(context, scenario):
|
||||
"""After each scenario, restore all test data and remove backups."""
|
||||
context.messages.close()
|
||||
context.messages = None
|
||||
for folder in ("configs", "journals"):
|
||||
original = os.path.join("features", folder)
|
||||
backup = os.path.join("features", folder+"_backup")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue