merge in develop

This commit is contained in:
Jonathan Wren 2022-03-12 13:54:11 -08:00
commit 2051f04839
17 changed files with 412 additions and 108 deletions

View file

@ -83,6 +83,7 @@ Feature: Reading and writing to journal with custom date formats
Then the output should not contain "Life is good"
And the output should not contain "But I'm better."
Scenario Outline: Create entry using day of the week as entry date one.
Given we use the config "simple.yaml"
And now is "2019-03-12 01:30:32 PM"
@ -172,3 +173,28 @@ Feature: Reading and writing to journal with custom date formats
Then we should get no error
And the output should be
2013-10-27 03:27 Some text.
@skip #1422
Scenario Outline: Using "tomorrow" near daylight savings works in Dayone journals
Given we use the config "dayone.yaml"
And now is "<date>"
When we run "jrnl yesterday: This thing happened yesterday"
Then the output should contain "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."
Then the output should contain "Entry added"
When we run "jrnl tomorrow: A future entry."
Then the output should contain "Entry added"
When we run "jrnl -from yesterday -to today"
Then the output should contain "This thing happened yesterday"
And the output should contain "Adding an entry right now."
And the output should not contain "A future entry."
Examples: Dates
| date |
| 2022-02-10 01:00:00 PM |
| 2021-03-13 01:00:00 PM |
| 2021-11-06 01:00:00 PM |
| 2022-03-12 01:00:00 PM |
| 2022-11-05 01:00:00 PM |

View file

@ -36,6 +36,7 @@ Feature: Searching in a journal
Scenario Outline: Displaying entries using -from and -to day should display correct entries
Given we use the config "<config_file>"
And now is "2022-03-10 02:32:00 PM"
When we run "jrnl yesterday: This thing happened yesterday"
Then the output should contain "Entry added"
When we run "jrnl today at 11:59pm: Adding an entry right now."

View file

@ -1,6 +1,5 @@
default_hour: 9
default_minute: 0
editor: ""
encrypt: false
highlight: true
editor: "vim"

View file

@ -8,7 +8,7 @@ from xml.etree import ElementTree
from pytest_bdd import then
from pytest_bdd.parsers import parse
import yaml
from ruamel.yaml import YAML
from jrnl.config import scope_config
@ -121,7 +121,7 @@ def config_var_on_disk(config_on_disk, journal_name, should_or_should_not, some_
if journal_name:
actual = actual["journals"][journal_name]
expected = yaml.load(some_yaml, Loader=yaml.SafeLoader)
expected = YAML(typ="safe").load(some_yaml)
actual_slice = actual
if type(actual) is dict:
@ -152,7 +152,7 @@ def config_var_in_memory(
if journal_name:
actual = actual["journals"][journal_name]
expected = yaml.load(some_yaml, Loader=yaml.SafeLoader)
expected = YAML(typ="safe").load(some_yaml)
actual_slice = actual
if type(actual) is dict:

View file

@ -1,21 +0,0 @@
import textwrap
from jrnl.exception import JrnlException
from jrnl.exception import JrnlExceptionMessage
def test_config_directory_exception_message():
ex = JrnlException(
JrnlExceptionMessage.ConfigDirectoryIsFile,
config_directory_path="/config/directory/path",
)
assert ex.message == textwrap.dedent(
"""
The path to your jrnl configuration directory is a file, not a directory:
/config/directory/path
Removing this file will allow jrnl to save its configuration.
"""
)

View file

@ -1,7 +1,6 @@
import pytest
from jrnl.exception import JrnlException
from jrnl.exception import JrnlExceptionMessage
from jrnl.plugins.fancy_exporter import check_provided_linewrap_viability
@ -24,8 +23,5 @@ class TestFancy:
total_linewrap = 12
with pytest.raises(JrnlException) as e:
with pytest.raises(JrnlException):
check_provided_linewrap_viability(total_linewrap, [content], journal)
assert (
e.value.exception_msg == JrnlExceptionMessage.LineWrapTooSmallForDateFormat
)