Skip to content
Myr

Merge pull request #2825 from eso31/fix-2824-issue

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

Fixes issue #2824 flask --version

authored by David Lord · committed by GitHub · parents 0f56c0c, a0ccc47 · Browse files · 3 files+19 added−8 removed
This commit

State

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

Diff stats

3 files+19 added−8 removed

  • tests:+6 added−5 removed
  • other:+13 added−3 removed

3 files+19 added−8 removed

modified:flask/cli.py+10 added-3 removed
12 unmodified lines
1314import ast15import inspect16import os17import platform18import re19import ssl20import sys21import traceback
237 unmodified lines
259260def get_version(ctx, param, value):261 if not value or ctx.resilient_parsing:262 return262 message = 'Flask %(version)s\nPython %(python_version)s'263 import werkzeug264 message = (265 'Python %(python)s\n'266 'Flask %(flask)s\n'267 'Werkzeug %(werkzeug)s'268 )269 click.echo(message % {264 'version': __version__,265 'python_version': sys.version,270 'python': platform.python_version(),271 'flask': __version__,272 'werkzeug': werkzeug.__version__,273 }, color=ctx.color)274 ctx.exit()275276
634 unmodified lines
modified:tests/test_cli.py+6 added-5 removed
239 unmodified lines
240 )241242243def test_get_version(test_apps, capsys):244 """Test of get_version."""245 from flask import __version__ as flask_ver246 from sys import version as py_ver244 from flask import __version__ as flask_version245 from werkzeug import __version__ as werkzeug_version246 from platform import python_version247248 class MockCtx(object):249 resilient_parsing = False250 color = None
2 unmodified lines
253254 ctx = MockCtx()255 get_version(ctx, None, "test")256 out, err = capsys.readouterr()257 assert flask_ver in out258 assert py_ver in out257 assert "Python " + python_version() in out258 assert "Flask " + flask_version in out259 assert "Werkzeug " + werkzeug_version in out260261262def test_scriptinfo(test_apps, monkeypatch):263 """Test of ScriptInfo."""
314 unmodified lines
modified:CHANGES.rst+3 added
12 unmodified lines
13 (ISO-8859-1). This fixes compatibility with Gunicorn, which is14 stricter about header encodings than PEP 3333. (`#2766`_)15- Allow custom CLIs using ``FlaskGroup`` to set the debug flag without16 it always being overwritten based on environment variables. (`#2765`_)17- ``flask --version`` outputs Werkzeug's version and simplifies the18 Python version. (`#2825`_)1920.. _#2766: https://github.com/pallets/flask/issues/276621.. _#2765: https://github.com/pallets/flask/pull/276522.. _#2825: https://github.com/pallets/flask/pull/2825232425Version 1.0.226-------------
896 unmodified lines