mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-20 21:18:32 +02:00
Add Python version check and faulty test to confirm it's working (should fail on 3.6 build only)
This commit is contained in:
parent
f86d923843
commit
34207f872f
3 changed files with 19 additions and 0 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"
|
||||
|
|
|
@ -371,6 +371,17 @@ def list_journal_directory(context, journal="default"):
|
|||
for file in f:
|
||||
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 "THIS SHOULD FAIL ON 3.6 REMOVE WHEN CONFIRMING - WARNING: Python versions" in out
|
||||
else:
|
||||
assert True
|
||||
|
||||
|
||||
@then("fail")
|
||||
def debug_fail(context):
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
import argparse
|
||||
import logging
|
||||
import packaging.version
|
||||
import platform
|
||||
import re
|
||||
import sys
|
||||
|
@ -313,6 +314,9 @@ def configure_logger(debug=False):
|
|||
|
||||
|
||||
def run(manual_args=None):
|
||||
if packaging.version.parse(platform.python_version()) < packaging.version.parse('3.7'):
|
||||
print("WARNING: Python versions below 3.7 are not supported by jrnl\n", file=sys.stderr)
|
||||
|
||||
if manual_args is None:
|
||||
manual_args = sys.argv[1:]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue