Add test for get_version (CLI) (#1884)
This commit is contained in:
parent
55bd39c7f0
commit
9121e109bd
1 changed files with 16 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ from flask import Flask, current_app
|
||||||
|
|
||||||
from flask.cli import AppGroup, FlaskGroup, NoAppException, ScriptInfo, \
|
from flask.cli import AppGroup, FlaskGroup, NoAppException, ScriptInfo, \
|
||||||
find_best_app, locate_app, with_appcontext, prepare_exec_for_file, \
|
find_best_app, locate_app, with_appcontext, prepare_exec_for_file, \
|
||||||
find_default_import_path
|
find_default_import_path, get_version
|
||||||
|
|
||||||
|
|
||||||
def test_cli_name(test_apps):
|
def test_cli_name(test_apps):
|
||||||
|
|
@ -98,6 +98,21 @@ def test_find_default_import_path(test_apps, monkeypatch, tmpdir):
|
||||||
assert find_default_import_path() == expect_rv
|
assert find_default_import_path() == expect_rv
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_version(test_apps, capsys):
|
||||||
|
"""Test of get_version."""
|
||||||
|
from flask import __version__ as flask_ver
|
||||||
|
from sys import version as py_ver
|
||||||
|
class MockCtx(object):
|
||||||
|
resilient_parsing = False
|
||||||
|
color = None
|
||||||
|
def exit(self): return
|
||||||
|
ctx = MockCtx()
|
||||||
|
get_version(ctx, None, "test")
|
||||||
|
out, err = capsys.readouterr()
|
||||||
|
assert flask_ver in out
|
||||||
|
assert py_ver in out
|
||||||
|
|
||||||
|
|
||||||
def test_scriptinfo(test_apps):
|
def test_scriptinfo(test_apps):
|
||||||
"""Test of ScriptInfo."""
|
"""Test of ScriptInfo."""
|
||||||
obj = ScriptInfo(app_import_path="cliapp.app:testapp")
|
obj = ScriptInfo(app_import_path="cliapp.app:testapp")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue