[tests] dynamically determine jrnl version for plugin tests

This commit is contained in:
MinchinWeb 2021-05-09 17:05:58 -06:00
parent 432681f8a3
commit 5a341cf13f
3 changed files with 44 additions and 39 deletions

View file

@ -540,6 +540,11 @@ def check_output_version_inline(context):
@then('the output should contain "{text}" or "{text2}"')
def check_output_inline(context, text=None, text2=None):
text = text or context.text
if "<pyproject.toml version>" in text:
pyproject = (Path(__file__) / ".." / ".." / ".." / "pyproject.toml").resolve()
pyproject_contents = toml.load(pyproject)
pyproject_version = pyproject_contents["tool"]["poetry"]["version"]
text = text.replace("<pyproject.toml version>", pyproject_version)
out = context.stdout_capture.getvalue()
assert (text and text in out) or (text2 and text2 in out)