Skip to content

Make PipTestEnvironment stderr checks more assertive #6871

Open
@chrahunt

Description

@chrahunt

We can tighten the tests in the following way. Rename the PipTestEnvironment.run() arguments of allow_stderr_warning and allow_stderr_error arguments to expect_stderr_warning and expect_stderr_error:

pip/tests/lib/__init__.py

Lines 501 to 507 in 2bfafc9

def run(self, *args, **kw):
"""
:param allow_stderr_warning: whether a logged warning (or
deprecation message) is allowed in stderr.
:param allow_stderr_error: whether a logged error is allowed in
stderr. Passing True for this argument implies
`allow_stderr_warning` since warnings are weaker than errors.

and make the test fail if the argument is passed and a warning or error isn't present, respectively. The idea is that the argument should only be passed if it's actually needed, unlike the current case where the test is passing if the argument is provided unnecessarily.

Also, to do this it might be necessary to do a check of some kind to know if the argument should be passed. For example, whether a deprecation warning is emitted can depend on what version is running.

Posted in its original form by @cjerdonek in #161 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: testsTesting and related thingsstate: awaiting PRFeature discussed, PR is neededtype: maintenanceRelated to Development and Maintenance Processes

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions