mirror of https://github.com/pypa/pip
Update test to check newer logic
This commit is contained in:
parent
3e0e45ba61
commit
a84dde5982
|
@ -1,21 +1,22 @@
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
def test_environ(script, tmpdir):
|
def test_environ(script, tmpdir):
|
||||||
"""$PYTHONWARNINGS was added in python2.7"""
|
"""$PYTHONWARNINGS was added in python2.7"""
|
||||||
demo = tmpdir.join('warnings_demo.py')
|
demo = tmpdir.join('warnings_demo.py')
|
||||||
demo.write('''
|
demo.write(textwrap.dedent('''
|
||||||
from pip._internal.utils import deprecation
|
from logging import basicConfig
|
||||||
deprecation.install_warning_logger()
|
from pip._internal.utils import deprecation
|
||||||
|
|
||||||
from logging import basicConfig
|
deprecation.install_warning_logger()
|
||||||
basicConfig()
|
basicConfig()
|
||||||
|
|
||||||
from warnings import warn
|
deprecation.deprecated("deprecated!", replacement=None, gone_in=None)
|
||||||
warn("deprecated!", deprecation.PipDeprecationWarning)
|
'''))
|
||||||
''')
|
|
||||||
|
|
||||||
result = script.run('python', demo, expect_stderr=True)
|
result = script.run('python', demo, expect_stderr=True)
|
||||||
assert result.stderr == \
|
expected = 'WARNING:pip._internal.deprecations:DEPRECATION: deprecated!\n'
|
||||||
'ERROR:pip._internal.deprecations:DEPRECATION: deprecated!\n'
|
assert result.stderr == expected
|
||||||
|
|
||||||
script.environ['PYTHONWARNINGS'] = 'ignore'
|
script.environ['PYTHONWARNINGS'] = 'ignore'
|
||||||
result = script.run('python', demo)
|
result = script.run('python', demo)
|
||||||
|
|
Loading…
Reference in New Issue