Skip to content
Myr

Merge pull request #4417 from pallets/remove-as_tuple

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

remove deprecated as_tuple parameter from test_client

authored by David Lord · committed by GitHub · parents d03df1f, aab064f · Browse files · 2 files+7 added−24 removed
This commit

State

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

Diff stats

2 files+7 added−24 removed

  • other:+7 added−24 removed

2 files+7 added−24 removed

modified:src/flask/testing.py+5 added-24 removed
177 unmodified lines
178 buffered: bool = False,179 follow_redirects: bool = False,180 **kwargs: t.Any,181 ) -> "TestResponse":182 as_tuple = kwargs.pop("as_tuple", None)183182 # Same logic as super.open, but apply environ_base and preserve_context.183 request = None184185 def copy_environ(other):
26 unmodified lines
212 request = builder.get_request()213 finally:214 builder.close()215218 if as_tuple is not None:219 import warnings216 return super().open(217 request,218 buffered=buffered,219 follow_redirects=follow_redirects,220 )221221 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 )240222 def __enter__(self) -> "FlaskClient":223 if self.preserve_context:224 raise RuntimeError("Cannot nest client invocations")225 self.preserve_context = True
54 unmodified lines
modified:CHANGES.rst+2 added
17 unmodified lines
18 - ``total_seconds`` is removed, use ``timedelta.total_seconds``19 instead.20 - The same blueprint cannot be registered with the same name. Use21 ``name=`` when registering to specify a unique name.22 - The test client's ``as_tuple`` parameter is removed. Use23 ``response.request.environ`` instead. :pr:`4417`2425- Some parameters in ``send_file`` and ``send_from_directory`` were26 renamed in 2.0. The deprecation period for the old names is extended27 to 2.2. Be sure to test with deprecation warnings visible.
1213 unmodified lines