Merge branch '2.1.x'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by David Lord · parents a03719b, 2ec1193 · Browse files · 5 files·+28 added−15 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+28 added−15 removed
- tests:+5 added−10 removed
- other:+23 added−5 removed
Provenance
- Commit
cb4f742- Tree
469531b- Author
David Lord <davidism@gmail.com>- Committer
David Lord <davidism@gmail.com>- Parent 1
a03719b- Parent 2
2ec1193
5 files changed+28 added−15 removed
modified:docs/testing.rst+3 added-3 removed
140 unmodified lines141 resources = Path(__file__).parent / "resources"142 143 def test_edit_user(client):144 response = client.post("/user/2/edit", data={145- name="Flask",146- theme="dark",147- picture=(resources / "picture.png").open("rb"),145+ "name": "Flask",146+ "theme": "dark",147+ "picture": (resources / "picture.png").open("rb"),148 })149 assert response.status_code == 200150 151 168 unmodified linesmodified:src/flask/json/__init__.py+5 added-1 removed
151 unmodified lines152 _dump_arg_defaults(kwargs, app=app)153 _json.dump(obj, fp, **kwargs)154 155 156-def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any:156+def loads(157+ s: t.Union[str, bytes],158+ app: t.Optional["Flask"] = None,159+ **kwargs: t.Any,160+) -> t.Any:161 """Deserialize an object from a string of JSON.162 163 Takes the same arguments as the built-in :func:`json.loads`, with164 some defaults from application configuration.139 unmodified linesmodified:src/flask/cli.py+4 added-1 removed
761 unmodified lines762 @click.command("run", short_help="Run a development server.")763 @click.option("--host", "-h", default="127.0.0.1", help="The interface to bind to.")764 @click.option("--port", "-p", default=5000, help="The port to bind to.")765 @click.option(766- "--cert", type=CertParamType(), help="Specify a certificate file to use HTTPS."766+ "--cert",767+ type=CertParamType(),768+ help="Specify a certificate file to use HTTPS.",769+ is_eager=True,770 )771 @click.option(772 "--key",773 type=click.Path(exists=True, dir_okay=False, resolve_path=True),219 unmodified linesmodified:tests/test_cli.py+5 added-10 removed
5 unmodified lines6 import sys7 import types8 from functools import partial9 from pathlib import Path10-from unittest.mock import patch10 11 import click12 import pytest13 from _pytest.monkeypatch import notset9 unmodified lines23 from flask.cli import FlaskGroup24 from flask.cli import get_version25 from flask.cli import load_dotenv26 from flask.cli import locate_app28-from flask.cli import main as cli_main27 from flask.cli import NoAppException28 from flask.cli import prepare_import29 from flask.cli import run_command30 from flask.cli import ScriptInfo521 unmodified lines552 # no cert553 with pytest.raises(click.BadParameter):554 run_command.make_context("run", ["--key", __file__])555 556+ # cert specified first557 ctx = run_command.make_context("run", ["--cert", __file__, "--key", __file__])558 assert ctx.params["cert"] == (__file__, __file__)559 560+ # key specified first561+ ctx = run_command.make_context("run", ["--key", __file__, "--cert", __file__])562+ assert ctx.params["cert"] == (__file__, __file__)563 564+565 def test_run_cert_adhoc(monkeypatch):566 monkeypatch.setitem(sys.modules, "cryptography", None)567 568 # cryptography not installed87 unmodified lines656 app.register_blueprint(bp)657 658 result = app.test_cli_runner().invoke(args=["blue", "--help"])659 assert result.exit_code == 2, f"Unexpected success:\n\n{result.output}"657-658-659-def test_click_7_deprecated():660- with patch("flask.cli.cli"):661- if int(click.__version__[0]) < 8:662- pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated")663- else:664- cli_main()modified:CHANGES.rst+11 added
4 unmodified lines5 6 Unreleased7 8 9+Version 2.1.210+-------------11+12+Unreleased13+14+- Fix type annotation for ``json.loads``, it accepts str or bytes.15+ :issue:`4519`16+- The ``--cert`` and ``--key`` options on ``flask run`` can be given17+ in either order. :issue:`4459`18+19+20 Version 2.1.121 -------------22 23 Released on 2022-03-301267 unmodified lines