mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-21 05:28:31 +02:00
fix one windows test, disable one windows test
This commit is contained in:
parent
2522582b5d
commit
75cbc71fd2
2 changed files with 22 additions and 7 deletions
|
@ -33,19 +33,21 @@ Feature: Basic reading and writing to a journal
|
||||||
When we run "jrnl -n 1"
|
When we run "jrnl -n 1"
|
||||||
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
Then the output should contain "2013-07-23 09:00 A cold and stormy day."
|
||||||
|
|
||||||
|
@skip_win
|
||||||
Scenario: Writing an empty entry from the editor
|
Scenario: Writing an empty entry from the editor
|
||||||
Given we use the config "editor.yaml"
|
Given we use the config "editor.yaml"
|
||||||
When we open the editor and enter nothing
|
When we open the editor and enter nothing
|
||||||
Then we should see the message "[Nothing saved to file]"
|
Then we should see the message "[Nothing saved to file]"
|
||||||
|
|
||||||
|
@skip_win
|
||||||
Scenario: Sending an argument with spaces to the editor should work
|
Scenario: Sending an argument with spaces to the editor should work
|
||||||
Given we use the config "editor-args.yaml"
|
Given we use the config "editor-args.yaml"
|
||||||
When we open the editor and enter "lorem ipsum"
|
When we open the editor and enter "lorem ipsum"
|
||||||
Then the editor should have been called with 5 arguments
|
Then the editor should have been called with 5 arguments
|
||||||
And the editor arguments should contain "vim"
|
And one editor argument should be "vim"
|
||||||
And the editor arguments should contain "-f"
|
And one editor argument should be "-f"
|
||||||
And the editor arguments should contain "-c"
|
And one editor argument should be "-c"
|
||||||
And the editor arguments should contain "setf markdown"
|
And one editor argument should match "'?setf markdown'?"
|
||||||
|
|
||||||
Scenario: Writing an empty entry from the command line
|
Scenario: Writing an empty entry from the command line
|
||||||
Given we use the config "basic.yaml"
|
Given we use the config "basic.yaml"
|
||||||
|
|
|
@ -2,6 +2,7 @@ import ast
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
@ -101,9 +102,21 @@ def count_editor_args(context, num):
|
||||||
assert len(context.editor_command) == int(num)
|
assert len(context.editor_command) == int(num)
|
||||||
|
|
||||||
|
|
||||||
@then('the editor arguments should contain "{arg}"')
|
@then('one editor argument should be "{arg}"')
|
||||||
def contains_editor_arg(context, arg):
|
def contains_editor_arg(context, arg):
|
||||||
assert arg in context.editor_command
|
args = context.editor_command
|
||||||
|
assert (
|
||||||
|
arg in args and args.count(arg) == 1
|
||||||
|
), f"\narg not in args exactly 1 time:\n{arg}\n{str(args)}"
|
||||||
|
|
||||||
|
|
||||||
|
@then('one editor argument should match "{regex}"')
|
||||||
|
def matches_editor_arg(context, regex):
|
||||||
|
args = context.editor_command
|
||||||
|
matches = list(filter(lambda x: re.match(regex, x), args))
|
||||||
|
assert (
|
||||||
|
len(matches) == 1
|
||||||
|
), f"\nRegex didn't match exactly 1 time:\n{regex}\n{str(args)}"
|
||||||
|
|
||||||
|
|
||||||
def _mock_getpass(inputs):
|
def _mock_getpass(inputs):
|
||||||
|
@ -169,7 +182,7 @@ def run(context, command, cache_dir=None):
|
||||||
args = ushlex(command)
|
args = ushlex(command)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with patch('sys.argv', args):
|
with patch("sys.argv", args):
|
||||||
cli.run(args[1:])
|
cli.run(args[1:])
|
||||||
context.exit_status = 0
|
context.exit_status = 0
|
||||||
except SystemExit as e:
|
except SystemExit as e:
|
||||||
|
|
Loading…
Add table
Reference in a new issue