mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-27 21:16:14 +02:00
Update pytest-bdd to v8.0 (#1955)
* Encapsulate all multiline strings in triple-quotes in Gherkin files Since pytest-bdd v8.0.0 uses the official Gherkin parser, multiline strings must now be encapsulated by triple-quotes. See: - https://pytest-bdd.readthedocs.io/en/stable/#id2 - https://pytest-bdd.readthedocs.io/en/stable/#docstrings * Remove comments in Gherkin files causing test breakage These comments break the step matching. * Fix compatibility of step-functions matching on multiple lines In pytest-bdd v8.0.0 it is no longer possible to match based on multiple lines, which breaks essentially all steps that support docstrings. Solve this by adding a wrapper-function for each of these instances, that matches the docstring step, and calls the original function. So, what used to be: @then(parse("the output should match\n{regex}")) @then(parse('the output should match "{regex}"')) def output_should_match(regex, cli_run): ... Is now: @then(parse("the output should match")) def output_should_match_docstring(cli_run, docstring): output_should_match(docstring, cli_run) @then(parse('the output should match "{regex}"')) def output_should_match(regex, cli_run): ... There is possibly a way around this that is much better than what I've done here, but this is a start at least. * Update version requirement of pytest-bdd to >=8.0 * Update tox config to match poetry config --------- Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
parent
505a9b6846
commit
1530ad39a1
23 changed files with 451 additions and 67 deletions
|
@ -27,7 +27,7 @@ Feature: Searching in a journal
|
|||
When we run "jrnl tomorrow: A future entry."
|
||||
Then we should get no error
|
||||
When we run "jrnl -from today"
|
||||
Then the output should contain "2 entries found"
|
||||
Then the output should contain "2 entries found"
|
||||
And the output should contain "Adding an entry right now."
|
||||
And the output should contain "A future entry."
|
||||
And the output should not contain "This thing happened yesterday"
|
||||
|
@ -65,7 +65,9 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "1 entry found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -92,9 +94,11 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "3 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-08-29 11:11 Entry the first.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -108,7 +112,9 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "1 entry found"
|
||||
And the output should be
|
||||
"""
|
||||
2020-09-24 09:14 The third entry finally after weeks without writing.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -219,19 +225,23 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
When we run "jrnl -2"
|
||||
Then the output should be
|
||||
"""
|
||||
2013-07-23 09:00 Testing folder journal.
|
||||
|
||||
2014-03-07 16:37 Second entry of journal.
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching for all tags should show counts of each tag
|
||||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
@tagtwo : 2
|
||||
@tagone : 2
|
||||
@tagthree : 1
|
||||
@ipsum : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -244,8 +254,10 @@ Feature: Searching in a journal
|
|||
When we run "jrnl -from 'september 2020' --tags"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -257,8 +269,10 @@ Feature: Searching in a journal
|
|||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagtwo"
|
||||
Then the output should be
|
||||
"""
|
||||
@tagthree : 1
|
||||
@tagone : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -270,7 +284,9 @@ Feature: Searching in a journal
|
|||
Given we use the config "<config_file>"
|
||||
When we run "jrnl --tags -not @tagone -not @tagthree"
|
||||
Then the output should be
|
||||
"""
|
||||
@tagtwo : 1
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -302,11 +318,13 @@ Feature: Searching in a journal
|
|||
When we run "jrnl -2"
|
||||
Then we should get no error
|
||||
And the output should be
|
||||
"""
|
||||
2013-06-09 15:39 My first entry.
|
||||
| Everything is alright
|
||||
|
||||
2013-06-10 15:40 Life is good.
|
||||
| But I'm better.
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching by month
|
||||
Given we use the config "<config_file>"
|
||||
|
@ -381,8 +399,10 @@ Feature: Searching in a journal
|
|||
And we run "jrnl -today-in-history --short"
|
||||
Then the output should contain "2 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2019-08-31 01:01 Hi, from last year.
|
||||
2020-08-31 14:32 A second entry in what I hope to be a long series.
|
||||
"""
|
||||
|
||||
Examples: configs
|
||||
| config_file |
|
||||
|
@ -397,11 +417,13 @@ Feature: Searching in a journal
|
|||
Then we should get no error
|
||||
And the output should contain "3 entries found"
|
||||
And the output should be
|
||||
"""
|
||||
2013-05-17 11:39 This entry has tags!
|
||||
|
||||
2013-06-17 20:38 This entry has a location.
|
||||
|
||||
2013-07-17 11:38 This entry is starred!
|
||||
"""
|
||||
|
||||
Scenario Outline: Searching the most recent entry should not show found count
|
||||
Given we use the config "<config_file>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue