-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Remove outdated docs about pytest.warns and DeprecatedWarning #8754
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
testing/test_warnings.py
Outdated
Check that recwarn can capture DeprecationWarning by default | ||
without custom filterwarnings (see #8666). | ||
""" | ||
pytester.makepyfile( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test should be inside test_recwarn.py?
also I don't think pytester
is needed here -- this can be tested directly (?)
the testsuite is failing because this test function name matches test_recwarn.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points, all done.
I initially used pytester to ensure our own warning filters wouldn't interfere with the test, but in the end I'm not sure it is needed after all.
Since pytest-dev#2908, the user doesn't need to set warning filters to capture `DeprecationWarning` with `pytest.warns`. Fix pytest-dev#8666
36dce60
to
84c5fe4
Compare
src/_pytest/tmpdir.py
Outdated
@@ -131,8 +131,8 @@ def getbasetemp(self) -> Path: | |||
# rootdir's permissions. Historically 0o755 was used, so we can't | |||
# just error out on this, at least for a while. | |||
if hasattr(os, "getuid"): | |||
uid = os.getuid() # type:ignore[attr-defined] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was done in a separate commit (84c5fe4).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the hasattr
check should be if sys.platform != 'win32'
-- this matches the guard from typeshed: https://github.com/python/typeshed/blob/48a346920bbc24165bd9e9cf29a2b5140eae2abc/stdlib/os/__init__.pyi#L388
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, thanks. Updated. 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the guard used by typeshed and avoid mypy errors on Windows: https://github.com/python/typeshed/blob/48a346920bbc24165bd9e9cf29a2b5140eae2abc/stdlib/os/__init__.pyi#L388
84c5fe4
to
16685dc
Compare
Backport: #8755 |
[6.2.x] Merge pull request #8754 from nicoddemus/fix-deprecation-docs
Since #2908, the user doesn't need to set warning filters to capture
DeprecationWarning
withpytest.warns
.Fix #8666