Merge pull request #4341 from pallets/test-min-dev
Before adoption: this commit came in with the history the project adopted, so no landing records it.
test against minimum/dev versions of Pallets libraries
authored by David Lord · committed by GitHub · parents 8600945, 564bb27 · Browse files · 11 files·+97 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+97 added−16 removed
- other:+97 added−16 removed
Provenance
- Commit
3720669- Tree
6c4240e- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
8600945- Parent 2
564bb27
11 files changed+97 added−16 removed
modified:.github/workflows/tests.yaml+2 added
31 unmodified lines3233343536373839404117 unmodified lines31 unmodified lines - {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38} - {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37} - {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36} - {name: 'PyPy', python: 'pypy-3.7', os: ubuntu-latest, tox: pypy37} - {name: 'Pallets Minimum Versions', python: '3.10', os: ubuntu-latest, tox: py-min} - {name: 'Pallets Development Versions', python: '3.7', os: ubuntu-latest, tox: py-dev} - {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing} steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v217 unmodified linesmodified:requirements/dev.txt+1 added-1 removed
36 unmodified lines37 filelock==3.3.238 # via39 # tox40 # virtualenv41-greenlet==1.1.241+greenlet==1.1.2 ; python_version < "3.11"42 # via -r requirements/tests.in43 identify==2.3.344 # via pre-commit45 idna==3.3118 unmodified linesadded:requirements/tests-pallets-dev.in+5 added
1+https://github.com/pallets/werkzeug/archive/refs/heads/main.tar.gz2+https://github.com/pallets/jinja/archive/refs/heads/main.tar.gz3+https://github.com/pallets/markupsafe/archive/refs/heads/main.tar.gz4+https://github.com/pallets/itsdangerous/archive/refs/heads/main.tar.gz5+https://github.com/pallets/click/archive/refs/heads/main.tar.gzadded:requirements/tests-pallets-dev.txt+18 added
1+#2+# This file is autogenerated by pip-compile with python 3.103+# To update, run:4+#5+# pip-compile requirements/tests-pallets-dev.in6+#7+click @ https://github.com/pallets/click/archive/refs/heads/main.tar.gz8+ # via -r requirements/tests-pallets-dev.in9+itsdangerous @ https://github.com/pallets/itsdangerous/archive/refs/heads/main.tar.gz10+ # via -r requirements/tests-pallets-dev.in11+jinja2 @ https://github.com/pallets/jinja/archive/refs/heads/main.tar.gz12+ # via -r requirements/tests-pallets-dev.in13+markupsafe @ https://github.com/pallets/markupsafe/archive/refs/heads/main.tar.gz14+ # via15+ # -r requirements/tests-pallets-dev.in16+ # jinja217+werkzeug @ https://github.com/pallets/werkzeug/archive/refs/heads/main.tar.gz18+ # via -r requirements/tests-pallets-dev.inadded:requirements/tests-pallets-min.in+5 added
1+Werkzeug==2.0.02+Jinja2==3.0.03+MarkupSafe==2.0.04+itsdangerous==2.0.05+click==8.0.0added:requirements/tests-pallets-min.txt+18 added
1+#2+# This file is autogenerated by pip-compile with python 3.103+# To update, run:4+#5+# pip-compile requirements/tests-pallets-min.in6+#7+click==8.0.08+ # via -r requirements/tests-pallets-min.in9+itsdangerous==2.0.010+ # via -r requirements/tests-pallets-min.in11+jinja2==3.0.012+ # via -r requirements/tests-pallets-min.in13+markupsafe==2.0.014+ # via15+ # -r requirements/tests-pallets-min.in16+ # jinja217+werkzeug==2.0.018+ # via -r requirements/tests-pallets-min.inmodified:requirements/tests.in+1 added-1 removed
1 pytest2 asgiref3 blinker4-greenlet4+greenlet ; python_version < "3.11"5 python-dotenvmodified:requirements/tests.txt+1 added-1 removed
8 unmodified lines9 attrs==21.2.010 # via pytest11 blinker==1.412 # via -r requirements/tests.in13-greenlet==1.1.213+greenlet==1.1.2 ; python_version < "3.11"14 # via -r requirements/tests.in15 iniconfig==1.1.116 # via pytest17 packaging==21.213 unmodified linesmodified:src/flask/testing.py+30 added-12 removed
7 unmodified lines8 from werkzeug.test import Client9 from werkzeug.urls import url_parse10 from werkzeug.wrappers import Request as BaseRequest11 12-from . import _request_ctx_stack12 from .cli import ScriptInfo13+from .globals import _request_ctx_stack14 from .json import dumps as json_dumps15 from .sessions import SessionMixin16 17 if t.TYPE_CHECKING:18+ from werkzeug.test import TestResponse19+20 from .app import Flask19- from .wrappers import Response21 22 23 class EnvironBuilder(werkzeug.test.EnvironBuilder):24 """An :class:`~werkzeug.test.EnvironBuilder`, that takes defaults from the146 unmodified lines171 session_interface.save_session(app, sess, resp)172 headers = resp.get_wsgi_headers(c.request.environ)173 self.cookie_jar.extract_wsgi(c.request.environ, headers)174 174- def open( # type: ignore175+ def open(176 self,177 *args: t.Any,177- as_tuple: bool = False,178 buffered: bool = False,179 follow_redirects: bool = False,180 **kwargs: t.Any,181- ) -> "Response":181+ ) -> "TestResponse":182+ as_tuple = kwargs.pop("as_tuple", None)183+184 # Same logic as super.open, but apply environ_base and preserve_context.185 request = None186 187 def copy_environ(other):26 unmodified lines214 request = builder.get_request()215 finally:216 builder.close()217 216- return super().open( # type: ignore217- request,218- as_tuple=as_tuple,219- buffered=buffered,220- follow_redirects=follow_redirects,221- )218+ if as_tuple is not None:219+ import warnings220 221+ warnings.warn(222+ "'as_tuple' is deprecated and will be removed in"223+ " Werkzeug 2.1 and Flask 2.1. Use"224+ " 'response.request.environ' instead.",225+ DeprecationWarning,226+ stacklevel=3,227+ )228+ return super().open(229+ request,230+ as_tuple=as_tuple,231+ buffered=buffered,232+ follow_redirects=follow_redirects,233+ )234+ else:235+ return super().open(236+ request,237+ buffered=buffered,238+ follow_redirects=follow_redirects,239+ )240+241 def __enter__(self) -> "FlaskClient":242 if self.preserve_context:243 raise RuntimeError("Cannot nest client invocations")244 self.preserve_context = True44 unmodified lines289 290 :return: a :class:`~click.testing.Result` object.291 """292 if cli is None:275- cli = self.app.cli293+ cli = self.app.cli # type: ignore294 295 if "obj" not in kwargs:296 kwargs["obj"] = ScriptInfo(create_app=lambda: self.app)297 1 unmodified linemodified:CHANGES.rst+11 added
1 .. currentmodule:: flask2 3+Version 2.0.34+-------------5+6+Unreleased7+8+- The test client's ``as_tuple`` parameter is deprecated and will be9+ removed in Werkzeug 2.1. It is now also deprecated in Flask, to be10+ removed in Flask 2.1, while remaining compatible with both in11+ 2.0.x. Use ``response.request.environ`` instead. :pr:`4341`12+13+14 Version 2.0.215 -------------16 17 Released 2021-10-041178 unmodified linesmodified:tox.ini+5 added-1 removed
1 [tox]2 envlist =3- py3{11,10,9,8,7,6},pypy373+ py3{11,10,9,8,7,6},pypy3{8,7}4 py39-click75+ py310-min6+ py37-dev7 style8 typing9 docs10 skip_missing_interpreters = true11 12 [testenv]13 deps =14 -r requirements/tests.txt15+ min: -r requirements/tests-pallets-min.txt16+ dev: -r requirements/tests-pallets-dev.txt17 18 click7: click<819 20 examples/tutorial[test]15 unmodified lines