From 7657bd7221b8f42bff66e1896b867659045b26f5 Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 13 Feb 2021 19:10:22 -0800 Subject: [PATCH] Implement version-checking test - Add new step definition Co-authored-by: Micah Jerome Ellison --- tests/step_defs/conftest.py | 12 ++++++++++++ tests/step_defs/test_features.py | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/tests/step_defs/conftest.py b/tests/step_defs/conftest.py index 2e62c561..1ebfe974 100644 --- a/tests/step_defs/conftest.py +++ b/tests/step_defs/conftest.py @@ -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 + diff --git a/tests/step_defs/test_features.py b/tests/step_defs/test_features.py index d670f9c9..b93f2140 100644 --- a/tests/step_defs/test_features.py +++ b/tests/step_defs/test_features.py @@ -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") + +