#NEWLINE# @ pytest . mark . skipif ( 'sys.version_info < (2,7)' ) #NEWLINE# def test_environ( script , tmpdir ) : #NEWLINE# #INDENT# '$PYTHONWARNINGS was added in python2.7' #NEWLINE# demo = tmpdir . join ( 'warnings_demo.py' ) #NEWLINE# demo . write ( '\nfrom pip.utils import deprecation\ndeprecation.install_warning_logger()\n\nfrom logging import basicConfig\nbasicConfig()\n\nfrom warnings import warn\nwarn("deprecated!", deprecation.PipDeprecationWarning)\n' ) #NEWLINE# result = script . run ( 'python' , demo , expect_stderr = True ) #NEWLINE# assert ( result . stderr == 'ERROR:pip.deprecations:DEPRECATION: deprecated!\n' ) #NEWLINE# script . environ [ 'PYTHONWARNINGS' ] = 'ignore' #NEWLINE# result = script . run ( 'python' , demo ) #NEWLINE# assert ( tmpdir . stderr == '' )