Add tests for core feature to pytest-bdd

- Implement "the output should contain" step

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-02-13 18:38:27 -08:00
parent 0b50ae1be0
commit 3055cca767
3 changed files with 21 additions and 0 deletions

View file

@ -65,6 +65,10 @@ force_sort_within_sections = true
[tool.pytest.ini_options]
minversion = "6.0"
markers = [
"todo",
]
[build-system]
requires = ["poetry>=1.1"]

View file

@ -6,3 +6,13 @@ Feature: Functionality of jrnl outside of actually handling journals
Then we should get no error
Then the output should match "^jrnl version v\d+\.\d+(\.\d+)?(-(alpha|beta)\d*)?"
Scenario: Running the diagnostic command
Given we use the config "simple.yaml"
When we run "jrnl --diagnostic"
Then the output should contain "jrnl"
And the output should contain "Python"
And the output should contain "OS"
@todo
Scenario: Listing available journals

View file

@ -91,3 +91,10 @@ def matches_std_output(regex, cli_run):
out = cli_run["stdout"]
matches = re.findall(regex, out)
assert matches, f"\nRegex didn't match:\n{regex}\n{str(out)}\n{str(matches)}"
@then(parse("the output should contain\n{text}"))
@then(parse('the output should contain "{text}"'))
def check_output_inline(text, cli_run):
assert text and text in cli_run['stdout']