diff --git a/features/regression.feature b/features/regression.feature index 5aa1db06..6b020980 100644 --- a/features/regression.feature +++ b/features/regression.feature @@ -122,3 +122,9 @@ Feature: Zapped bugs should stay dead. Then the output should contain "This thing happened yesterday" Then the output should contain "Adding an entry right now." Then the output should not contain "A future entry." + + Scenario: Version numbers should stay in sync + Given we use the config "basic.yaml" + When we run "jrnl --version" + Then we should get no error + Then the output should contain pyproject.toml version diff --git a/features/steps/core.py b/features/steps/core.py index 26398fc4..a2e6856e 100644 --- a/features/steps/core.py +++ b/features/steps/core.py @@ -19,6 +19,8 @@ import keyring import tzlocal import shlex import sys +from pathlib import Path +import tomlkit consts = pdt.Constants(usePyICU=False) consts.DOWParseStyle = -1 # Prefers past weekdays @@ -207,6 +209,15 @@ def check_output_time_inline(context, text): assert output_date in out, output_date +@then('the output should contain pyproject.toml version') +def check_output_version_inline(context): + out = context.stdout_capture.getvalue() + pyproject = (Path(__file__) / '..' / '..' / '..' / 'pyproject.toml').resolve() + pyproject_contents = tomlkit.parse(pyproject.open().read()) + pyproject_version = pyproject_contents['tool']['poetry']['version'] + assert pyproject_version in out, pyproject_version + + @then("the output should contain") @then('the output should contain "{text}"') @then('the output should contain "{text}" or "{text2}"') diff --git a/poetry.lock b/poetry.lock index 1a24ab9b..a87b13d7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -481,6 +481,14 @@ optional = false python-versions = "*" version = "0.10.0" +[[package]] +category = "dev" +description = "Style preserving TOML library" +name = "tomlkit" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "0.5.11" + [[package]] category = "dev" description = "Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed." @@ -522,7 +530,7 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["jaraco.itertools", "func-timeout"] [metadata] -content-hash = "98c4d0d25bb309075ca86c1ed3ed0d46b0fd1dad66510f8fe95b0ad350065df5" +content-hash = "cdaaa36d5431249548e74e1315f5288cbf2e0abf665fd71c462881d574fb28fa" python-versions = ">=3.6.0, <3.9.0" [metadata.files] @@ -677,6 +685,11 @@ markupsafe = [ {file = "MarkupSafe-1.1.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-win32.whl", hash = "sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2"}, {file = "MarkupSafe-1.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:6788b695d50a51edb699cb55e35487e430fa21f1ed838122d722e0ff0ac5ba15"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:13d3144e1e340870b25e7b10b98d779608c02016d5184cfb9927a9f10c689f42"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-win32.whl", hash = "sha256:596510de112c685489095da617b5bcbbac7dd6384aeebeda4df6025d0256a81b"}, + {file = "MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be"}, {file = "MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b"}, ] mccabe = [ @@ -790,6 +803,10 @@ toml = [ {file = "toml-0.10.0-py2.py3-none-any.whl", hash = "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"}, {file = "toml-0.10.0.tar.gz", hash = "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c"}, ] +tomlkit = [ + {file = "tomlkit-0.5.11-py2.py3-none-any.whl", hash = "sha256:4e1bd6c9197d984528f9ff0cc9db667c317d8881288db50db20eeeb0f6b0380b"}, + {file = "tomlkit-0.5.11.tar.gz", hash = "sha256:f044eda25647882e5ef22b43a1688fb6ab12af2fc50e8456cdfc751c873101cf"}, +] tornado = [ {file = "tornado-6.0.3-cp35-cp35m-win32.whl", hash = "sha256:c9399267c926a4e7c418baa5cbe91c7d1cf362d505a1ef898fde44a07c9dd8a5"}, {file = "tornado-6.0.3-cp35-cp35m-win_amd64.whl", hash = "sha256:398e0d35e086ba38a0427c3b37f4337327231942e731edaa6e9fd1865bbd6f60"}, diff --git a/pyproject.toml b/pyproject.toml index 783b8dcd..f64a9bf2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,6 +35,7 @@ behave = "^1.2" mkdocs = "^1.0" flake8 = "^3.7" black = {version = "^19.10b0",allow-prereleases = true} +tomlkit = "^0.5.11" [tool.poetry.scripts] jrnl = 'jrnl.cli:run'