From 411dbb37e2e37943b6282365049c2a8cee4ac9e6 Mon Sep 17 00:00:00 2001 From: David Lord Date: Mon, 11 Apr 2022 06:11:37 -0700 Subject: [PATCH 1/5] remove old test --- tests/test_cli.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index a2fcc5a1..6271c72a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -7,7 +7,6 @@ import sys import types from functools import partial from pathlib import Path -from unittest.mock import patch import click import pytest @@ -25,7 +24,6 @@ from flask.cli import FlaskGroup from flask.cli import get_version from flask.cli import load_dotenv from flask.cli import locate_app -from flask.cli import main as cli_main from flask.cli import NoAppException from flask.cli import prepare_import from flask.cli import run_command @@ -654,11 +652,3 @@ def test_cli_empty(app): result = app.test_cli_runner().invoke(args=["blue", "--help"]) assert result.exit_code == 2, f"Unexpected success:\n\n{result.output}" - - -def test_click_7_deprecated(): - with patch("flask.cli.cli"): - if int(click.__version__[0]) < 8: - pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated") - else: - cli_main() From 4dd14ed039aaab5edb50758edeaf0aacab3d1e5b Mon Sep 17 00:00:00 2001 From: MeViMo Date: Wed, 13 Apr 2022 18:49:51 +0200 Subject: [PATCH 2/5] Syntax error in testing.rst --- docs/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/testing.rst b/docs/testing.rst index e259f098..6f9d6ee1 100644 --- a/docs/testing.rst +++ b/docs/testing.rst @@ -142,9 +142,9 @@ use ``pathlib.Path`` to get files relative to the current test file. def test_edit_user(client): response = client.post("/user/2/edit", data={ - name="Flask", - theme="dark", - picture=(resources / "picture.png").open("rb"), + "name": "Flask", + "theme": "dark", + "picture": (resources / "picture.png").open("rb"), }) assert response.status_code == 200 From 69f71b4d94006678a2463f76a4504208d195c367 Mon Sep 17 00:00:00 2001 From: David Lord Date: Sun, 24 Apr 2022 09:50:55 -0700 Subject: [PATCH 3/5] start version 2.1.2 --- CHANGES.rst | 6 ++++++ src/flask/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9e740614..945237cd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,5 +1,11 @@ .. currentmodule:: flask +Version 2.1.2 +------------- + +Unreleased + + Version 2.1.1 ------------- diff --git a/src/flask/__init__.py b/src/flask/__init__.py index 75f9411f..c2bf355f 100644 --- a/src/flask/__init__.py +++ b/src/flask/__init__.py @@ -42,4 +42,4 @@ from .signals import template_rendered as template_rendered from .templating import render_template as render_template from .templating import render_template_string as render_template_string -__version__ = "2.1.1" +__version__ = "2.1.2.dev0" From eede1a3685e21deaeb6686e9de9b76a73b6a510c Mon Sep 17 00:00:00 2001 From: Rafael Zimmer Date: Tue, 12 Apr 2022 13:17:24 -0300 Subject: [PATCH 4/5] fix annotation for json.loads --- CHANGES.rst | 3 +++ src/flask/json/__init__.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 945237cd..0d96a61e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,6 +5,9 @@ Version 2.1.2 Unreleased +- Fix type annotation for ``json.loads``, it accepts str or bytes. + :issue:`4519` + Version 2.1.1 ------------- diff --git a/src/flask/json/__init__.py b/src/flask/json/__init__.py index 43c018e7..edc9793d 100644 --- a/src/flask/json/__init__.py +++ b/src/flask/json/__init__.py @@ -153,7 +153,11 @@ def dump( _json.dump(obj, fp, **kwargs) -def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any: +def loads( + s: t.Union[str, bytes], + app: t.Optional["Flask"] = None, + **kwargs: t.Any, +) -> t.Any: """Deserialize an object from a string of JSON. Takes the same arguments as the built-in :func:`json.loads`, with From 5050a18a0057df4cda6f6b00483d12d29cb59239 Mon Sep 17 00:00:00 2001 From: James Warne <15948170+bebleo@users.noreply.github.com> Date: Mon, 18 Apr 2022 08:52:01 -0400 Subject: [PATCH 5/5] evaluate --cert before --key --- CHANGES.rst | 2 ++ src/flask/cli.py | 5 ++++- tests/test_cli.py | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0d96a61e..68ef94fd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,8 @@ Unreleased - Fix type annotation for ``json.loads``, it accepts str or bytes. :issue:`4519` +- The ``--cert`` and ``--key`` options on ``flask run`` can be given + in either order. :issue:`4459` Version 2.1.1 diff --git a/src/flask/cli.py b/src/flask/cli.py index 972698df..36c4f1b6 100644 --- a/src/flask/cli.py +++ b/src/flask/cli.py @@ -763,7 +763,10 @@ class SeparatedPathType(click.Path): @click.option("--host", "-h", default="127.0.0.1", help="The interface to bind to.") @click.option("--port", "-p", default=5000, help="The port to bind to.") @click.option( - "--cert", type=CertParamType(), help="Specify a certificate file to use HTTPS." + "--cert", + type=CertParamType(), + help="Specify a certificate file to use HTTPS.", + is_eager=True, ) @click.option( "--key", diff --git a/tests/test_cli.py b/tests/test_cli.py index 6271c72a..f9f3673a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -553,9 +553,14 @@ def test_run_cert_path(): with pytest.raises(click.BadParameter): run_command.make_context("run", ["--key", __file__]) + # cert specified first ctx = run_command.make_context("run", ["--cert", __file__, "--key", __file__]) assert ctx.params["cert"] == (__file__, __file__) + # key specified first + ctx = run_command.make_context("run", ["--key", __file__, "--cert", __file__]) + assert ctx.params["cert"] == (__file__, __file__) + def test_run_cert_adhoc(monkeypatch): monkeypatch.setitem(sys.modules, "cryptography", None)