mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-06-28 05:26:13 +02:00
Display warning if Python version is less than 3.7 (#994)
* Add Python version check and faulty test to confirm it's working (should fail on 3.6 build only) * Apply formatting * Fix behave Python version test * Make error message more descriptive and friendly
This commit is contained in:
parent
686fc0cfdf
commit
4ca6e3f95f
3 changed files with 32 additions and 1 deletions
|
@ -135,3 +135,7 @@ Feature: Basic reading and writing to a journal
|
|||
When we run "jrnl --diagnostic"
|
||||
Then the output should contain "jrnl"
|
||||
And the output should contain "Python"
|
||||
|
||||
Scenario: Version warning appears for versions below 3.7
|
||||
When we run "jrnl --diagnostic"
|
||||
Then the Python version warning should appear if our version is below 3.7
|
||||
|
|
|
@ -372,6 +372,20 @@ def list_journal_directory(context, journal="default"):
|
|||
print(os.path.join(root, file))
|
||||
|
||||
|
||||
@then("the Python version warning should appear if our version is below {version}")
|
||||
def check_python_warning_if_version_low_enough(context, version):
|
||||
import packaging.version
|
||||
import platform
|
||||
|
||||
if packaging.version.parse(platform.python_version()) < packaging.version.parse(
|
||||
version
|
||||
):
|
||||
out = context.stderr_capture.getvalue()
|
||||
assert "WARNING: Python versions" in out
|
||||
else:
|
||||
assert True
|
||||
|
||||
|
||||
@then("fail")
|
||||
def debug_fail(context):
|
||||
assert False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue