Skip to content

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

Merged
merged 2 commits into from
Jun 12, 2021

Conversation

nicoddemus
Copy link
Member

Since #2908, the user doesn't need to set warning filters to capture
DeprecationWarning with pytest.warns.

Fix #8666

@nicoddemus nicoddemus added the needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch label Jun 12, 2021
Check that recwarn can capture DeprecationWarning by default
without custom filterwarnings (see #8666).
"""
pytester.makepyfile(
Copy link
Member

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

Copy link
Member Author

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
@nicoddemus nicoddemus force-pushed the fix-deprecation-docs branch from 36dce60 to 84c5fe4 Compare June 12, 2021 15:12
@@ -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]
Copy link
Member Author

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).

Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, thanks. Updated. 👍

Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicoddemus nicoddemus force-pushed the fix-deprecation-docs branch from 84c5fe4 to 16685dc Compare June 12, 2021 15:32
@nicoddemus nicoddemus enabled auto-merge June 12, 2021 15:33
@nicoddemus nicoddemus merged commit c675d80 into pytest-dev:main Jun 12, 2021
nicoddemus added a commit to nicoddemus/pytest that referenced this pull request Jun 12, 2021
@nicoddemus nicoddemus deleted the fix-deprecation-docs branch June 12, 2021 16:46
@nicoddemus
Copy link
Member Author

Backport: #8755

nicoddemus added a commit that referenced this pull request Jun 12, 2021
[6.2.x] Merge pull request #8754 from nicoddemus/fix-deprecation-docs
@nicoddemus nicoddemus added backported and removed needs backport applied to PRs, indicates that it should be ported to the current bug-fix branch labels Jun 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants