Skip to content
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

Move docstring to appropriately placed comment #6933

Merged
merged 1 commit into from
Sep 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/functional/test_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


def test_environ(script, tmpdir):
"""$PYTHONWARNINGS was added in python2.7"""
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 was meant to describe what the test is doing. Moving this below makes it seem like the test is meaningful on its own and PYTHONWARNINGS was added later. I would update this docstring to be e.g. "Test PYTHONWARNINGS, as added in python2.7" or remove the docstring and update the test name to test_PYTHONWARNINGS.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea... However, given that 2.7 is the lowest version we have, it doesn't describe much. Anyway, IMO this is one of the doc-strings that don't add value by being there (it doesn't describe the test).

We should do follow up PR, adding a more useful docstring -- I'll merge, since test_warnings.py::test_environ probably explains enough about this test, for now?

demo = tmpdir.joinpath('warnings_demo.py')
demo.write_text(textwrap.dedent('''
from logging import basicConfig
Expand All @@ -18,6 +17,7 @@ def test_environ(script, tmpdir):
expected = 'WARNING:pip._internal.deprecations:DEPRECATION: deprecated!\n'
assert result.stderr == expected

# $PYTHONWARNINGS was added in python2.7
script.environ['PYTHONWARNINGS'] = 'ignore'
result = script.run('python', demo)
assert result.stderr == ''