-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Allow finer-grained testing of subprocess stderr. #6342
Conversation
428f0f3
to
7a6e1aa
Compare
7a6e1aa
to
2e98d39
Compare
Also, a benefit of this independent of PR #6339 is that in cases where we expect only a warning (e.g. deprecated Python versions), we can limit ourselves to being okay only with warnings and not also logged errors. In a subsequent PR, we can try making “expect_stderr” mean only “expect warning” and not “expect error.” This will make the tests more useful. |
tests/lib/__init__.py
Outdated
are weaker than errors. | ||
""" | ||
if expect_stderr_error: | ||
expect_stderr_warning = True |
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.
Passing explicitely expect_stderr_warning=False, expect_stderr_error=True
should raise then (and expect_stderr_warning
should default to None
, meaning either False
or True
depending on expect_stderr_error
value)
629449f
to
bb290e1
Compare
Thanks, @xavfernandez. I incorporated the suggestion in your comment -- including adding a test case to check that the exception works. In the process of doing so, I also added a number of other test cases to check that various combinations of the arguments are working as intended. |
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.
Thanks 👍
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR adds
expect_stderr_warning
andexpect_stderr_error
arguments toPipTestEnvironment
to permit finer-grained testing ofstderr
. It allows checking whether errors and warnings were logged in the subprocess, rather than simply checking whether stderr is non-empty.This is most immediately to help with PR #6339.