Implement version-checking test

- Add new step definition

Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
This commit is contained in:
Jonathan Wren 2021-02-13 19:10:22 -08:00
parent 3055cca767
commit 7657bd7221
2 changed files with 28 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import shutil
import os
import re
import tempfile
import toml
from pytest import fixture
from pytest_bdd import given
@ -30,6 +31,11 @@ def temp_dir():
def working_dir(request):
return os.path.join(request.config.rootpath, "tests")
@fixture
def toml_version(working_dir):
pyproject = os.path.join(working_dir, "..", "pyproject.toml")
pyproject_contents = toml.load(pyproject)
return pyproject_contents["tool"]["poetry"]["version"]
# ----- STEPS ----- #
@given(parse('we use the config "{config_file}"'), target_fixture="config_path")
@ -98,3 +104,9 @@ def matches_std_output(regex, cli_run):
def check_output_inline(text, cli_run):
assert text and text in cli_run['stdout']
@then("the output should contain pyproject.toml version")
def check_output_version_inline(cli_run, toml_version):
out = cli_run['stdout']
assert toml_version in out, toml_version

View file

@ -1,3 +1,19 @@
from pytest_bdd import scenarios
scenarios("../features/build.feature")
scenarios("../features/core.feature")
# scenarios("../features/datetime.feature")
# scenarios("../features/delete.feature")
# scenarios("../features/encrypt.feature")
# scenarios("../features/file_storage.feature")
# scenarios("../features/format.feature")
# scenarios("../features/import.feature")
# scenarios("../features/multiple_journals.feature")
# scenarios("../features/password.feature")
# scenarios("../features/search.feature")
# scenarios("../features/star.feature")
# scenarios("../features/tag.feature")
# scenarios("../features/upgrade.feature")
# scenarios("../features/write.feature")