AI junk#6099
Closed
eeshsaxena wants to merge 1 commit into
Closed
Conversation
pytest 9.1 removed the notset sentinel from _pytest.monkeypatch, moving it to _pytest.compat.NOTSET (a private location). Importing from either private path breaks on pytest 9.1+. Both usages only needed notset to signal 'delete this env var before the test runs'. monkeypatch.delenv(key, raising=False) does exactly that using the stable public API, so drop the sentinel entirely. tests/conftest.py: - Remove 'from _pytest import monkeypatch' import. - Replace notset sentinel tuple with a plain tuple of key names. - Use pytest.MonkeyPatch() directly (public class). - _reset_os_environ now calls monkeypatch.delenv() per key instead of appending to the private _setitem list. tests/test_cli.py: - Remove 'from _pytest.monkeypatch import notset'. - Replace _setitem.append(..., notset) with monkeypatch.delenv(raising=False) in test_load_dotenv and test_dotenv_path. Fixes #6071
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.
Fixes #6071.
The test suite imports
otset\ from _pytest.monkeypatch\ in two places and also pokes the private _setitem\ list directly. pytest 9.1 removed
otset\ from that module, which causes a collection-time crash before any test can run.
Both usages only needed the sentinel to mean 'delete this env var'. \monkeypatch.delenv(key, raising=False)\ does exactly the same thing using the stable public API, so the sentinel is not needed at all.
tests/conftest.py
otset\ tuple with a plain tuple of key names (_FLASK_ENV_KEYS).
tests/test_cli.py