Skip to content
Myr

Add test for get_version (CLI) (#1884)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Anton Sarukhanov · committed by Markus Unterwaditzer · parent 55bd39c · Browse files · 1 file+16 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−1 removed

  • tests:+16 added−1 removed

1 file+16 added−1 removed

modified:tests/test_cli.py+16 added-1 removed
20 unmodified lines
21from flask import Flask, current_app2223from flask.cli import AppGroup, FlaskGroup, NoAppException, ScriptInfo, \24 find_best_app, locate_app, with_appcontext, prepare_exec_for_file, \25 find_default_import_path25 find_default_import_path, get_version262728def test_cli_name(test_apps):29 """Make sure the CLI object's name is the app's name and not the app itself"""
67 unmodified lines
97 expect_rv = prepare_exec_for_file(str(tmpfile))98 assert find_default_import_path() == expect_rv99100101def test_get_version(test_apps, capsys):102 """Test of get_version."""103 from flask import __version__ as flask_ver104 from sys import version as py_ver105 class MockCtx(object):106 resilient_parsing = False107 color = None108 def exit(self): return109 ctx = MockCtx()110 get_version(ctx, None, "test")111 out, err = capsys.readouterr()112 assert flask_ver in out113 assert py_ver in out114115116def test_scriptinfo(test_apps):117 """Test of ScriptInfo."""118 obj = ScriptInfo(app_import_path="cliapp.app:testapp")119 assert obj.load_app().name == "testapp"
73 unmodified lines