mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Python 3 compatibility for tests
This commit is contained in:
parent
29005c0e07
commit
03c1395c01
1 changed files with 5 additions and 2 deletions
|
@ -3,7 +3,10 @@ from jrnl import jrnl
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
import StringIO
|
try:
|
||||||
|
from io import StringIO
|
||||||
|
except ImportError:
|
||||||
|
from cStringIO import StringIO
|
||||||
|
|
||||||
def read_journal(journal_name="default"):
|
def read_journal(journal_name="default"):
|
||||||
with open(jrnl.CONFIG_PATH) as config_file:
|
with open(jrnl.CONFIG_PATH) as config_file:
|
||||||
|
@ -22,7 +25,7 @@ def set_config(context, config_file):
|
||||||
def run_with_input(context, command, inputs=None):
|
def run_with_input(context, command, inputs=None):
|
||||||
text = inputs or context.text
|
text = inputs or context.text
|
||||||
args = command.split()[1:]
|
args = command.split()[1:]
|
||||||
buffer = StringIO.StringIO(text.strip())
|
buffer = StringIO(text.strip())
|
||||||
jrnl.util.STDIN = buffer
|
jrnl.util.STDIN = buffer
|
||||||
jrnl.cli(args)
|
jrnl.cli(args)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue