Skip to content
Myr

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

5 files+28 added−15 removed

modified:docs/testing.rst+3 added-3 removed
140 unmodified lines
141 resources = Path(__file__).parent / "resources"142143 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 == 200150151
168 unmodified lines
modified:src/flask/json/__init__.py+5 added-1 removed
151 unmodified lines
152 _dump_arg_defaults(kwargs, app=app)153 _json.dump(obj, fp, **kwargs)154155156def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any:156def 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.162163 Takes the same arguments as the built-in :func:`json.loads`, with164 some defaults from application configuration.
139 unmodified lines
modified:src/flask/cli.py+4 added-1 removed
761 unmodified lines
762@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 lines
modified:tests/test_cli.py+5 added-10 removed
5 unmodified lines
6import sys7import types8from functools import partial9from pathlib import Path10from unittest.mock import patch1011import click12import pytest13from _pytest.monkeypatch import notset
9 unmodified lines
23from flask.cli import FlaskGroup24from flask.cli import get_version25from flask.cli import load_dotenv26from flask.cli import locate_app28from flask.cli import main as cli_main27from flask.cli import NoAppException28from flask.cli import prepare_import29from flask.cli import run_command30from flask.cli import ScriptInfo
521 unmodified lines
552 # no cert553 with pytest.raises(click.BadParameter):554 run_command.make_context("run", ["--key", __file__])555556 # cert specified first557 ctx = run_command.make_context("run", ["--cert", __file__, "--key", __file__])558 assert ctx.params["cert"] == (__file__, __file__)559560 # key specified first561 ctx = run_command.make_context("run", ["--key", __file__, "--cert", __file__])562 assert ctx.params["cert"] == (__file__, __file__)563564565def test_run_cert_adhoc(monkeypatch):566 monkeypatch.setitem(sys.modules, "cryptography", None)567568 # cryptography not installed
87 unmodified lines
656 app.register_blueprint(bp)657658 result = app.test_cli_runner().invoke(args=["blue", "--help"])659 assert result.exit_code == 2, f"Unexpected success:\n\n{result.output}"657658659def 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 lines
56Unreleased789Version 2.1.210-------------1112Unreleased1314- 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`181920Version 2.1.121-------------2223Released on 2022-03-30
1267 unmodified lines