AI junk#6091
Closed
usamashehab wants to merge 1 commit into
Closed
Conversation
pytest 9.1 removed the private `notset` sentinel from `_pytest.monkeypatch` (now `NOTSET` in `_pytest.compat`) and the `_setitem` list is no longer a stable interface. The test suite imported `notset` and directly manipulated `monkeypatch._setitem`, causing a collection-time crash. Replace all private API usage with public `monkeypatch.delenv()`: - conftest.py: use `pytest.MonkeyPatch()` + `delenv()` instead of `monkeypatch.MonkeyPatch()` + `notset`; make `_reset_os_environ` clean up dotenv test keys (FOO, BAR, SPAM, HAM, EGGS) that `load_dotenv()` sets directly, bypassing monkeypatch's tracking. - test_cli.py: replace `_setitem.append((os.environ, item, notset))` with `monkeypatch.delenv(item, raising=False)`. fixes #6071
Author
|
The two failing CI jobs ("Development Versions" and "Minimum Versions") are pre-existing failures on I verified by checking the latest CI run on
All other jobs pass (3.10, 3.11, 3.12, 3.13, 3.14, 3.14t, PyPy, Windows, Mac, typing, docs). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #6071 and two pre-existing CI failures on
main.pytest 9.1 compatibility (#6071)
pytest 9.1 removed the private
notsetsentinel from_pytest.monkeypatch(nowNOTSETin_pytest.compat). The test suite importednotsetand directly manipulatedmonkeypatch._setitem, causing a collection-time crash with pytest 9.1+.tests/conftest.py: Usepytest.MonkeyPatch()+delenv()instead of_pytest.monkeypatch.MonkeyPatch()+notset. The_reset_os_environfixture now also cleans up dotenv test keys (FOO,BAR,SPAM,HAM,EGGS) thatload_dotenv()sets directly, bypassing monkeypatch's tracking.tests/test_cli.py: Replacefrom _pytest.monkeypatch import notsetandmonkeypatch._setitem.append((os.environ, item, notset))withmonkeypatch.delenv(item, raising=False).Development Versions CI: deprecated werkzeug API
werkzeug main (3.2 dev) deprecated
parse_cache_control_headerandparse_set_header(removal in 3.3). Withfilterwarnings = ["error"], theDeprecationWarningcrashes test collection.tests/test_blueprints.py: UseResponseCacheControl.from_header()instead ofparse_cache_control_header(), withhasattrfallback to the old function forwerkzeug < 3.2.tests/test_views.py: UseHeaderSet.from_header()instead ofparse_set_header(), withhasattrfallback forwerkzeug < 3.2.Minimum Versions CI: click ParamType subscripting
click.ParamTypebecame subscriptable in click 8.2, but Flask declaresclick>=8.1.3as minimum.class CertParamType(click.ParamType[t.Any])crashes on click 8.1.3 withTypeError: type 'ParamType' is not subscriptable.src/flask/cli.py: Useclick.ParamTypedirectly as the base class — the generic parameter is only for type checkers and has no runtime effect.Test Plan
notset)filterwarnings = ["error"]