<s> """<STR_LIT>""" <EOL> import os <EOL> import sys <EOL> import unittest <EOL> from test . test_support import EnvironmentVarGuard , run_unittest <EOL> from distutils import sysconfig <EOL> from distutils . unixccompiler import UnixCCompiler <EOL> class UnixCCompilerTestCase ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> self . _backup_platform = sys . platform <EOL> self . _backup_get_config_var = sysconfig . get_config_var <EOL> class CompilerWrapper ( UnixCCompiler ) : <EOL> def rpath_foo ( self ) : <EOL> return self . runtime_library_dir_option ( '<STR_LIT>' ) <EOL> self . cc = CompilerWrapper ( ) <EOL> def tearDown ( self ) : <EOL> sys . platform = self . _backup_platform <EOL> sysconfig . get_config_var = self . _backup_get_config_var <EOL> @ unittest . skipIf ( sys . platform == '<STR_LIT:win32>' , "<STR_LIT>" ) <EOL> def test_runtime_libdir_option ( self ) : <EOL> sys . platform = '<STR_LIT>' <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT>' <EOL> old_gcv = sysconfig . get_config_var <EOL> def gcv ( v ) : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def gcv ( v ) : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def gcv ( v ) : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> sysconfig . get_config_var = old_gcv <EOL> sys . platform = '<STR_LIT>' <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> sys . platform = '<STR_LIT>' <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> sys . platform = '<STR_LIT:bar>' <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> elif v == '<STR_LIT>' : <EOL> return '<STR_LIT:yes>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT:bar>' <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> elif v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT:bar>' <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> elif v == '<STR_LIT>' : <EOL> return '<STR_LIT:yes>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT:bar>' <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> elif v == '<STR_LIT>' : <EOL> return '<STR_LIT:yes>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT:bar>' <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> elif v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> sys . platform = '<STR_LIT>' <EOL> def gcv ( v ) : <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> self . assertEqual ( self . cc . rpath_foo ( ) , '<STR_LIT>' ) <EOL> @ unittest . skipUnless ( sys . platform == '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_osx_cc_overrides_ldshared ( self ) : <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> with EnvironmentVarGuard ( ) as env : <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> del env [ '<STR_LIT>' ] <EOL> sysconfig . customize_compiler ( self . cc ) <EOL> self . assertEqual ( self . cc . linker_so [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> @ unittest . skipUnless ( sys . platform == '<STR_LIT>' , '<STR_LIT>' ) <EOL> def test_osx_explict_ldshared ( self ) : <EOL> def gcv ( v ) : <EOL> if v == '<STR_LIT>' : <EOL> return '<STR_LIT>' <EOL> return '<STR_LIT>' <EOL> sysconfig . get_config_var = gcv <EOL> with EnvironmentVarGuard ( ) as env : <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> env [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> sysconfig . customize_compiler ( self . cc ) <EOL> self . assertEqual ( self . cc . linker_so [ <NUM_LIT:0> ] , '<STR_LIT>' ) <EOL> def test_suite ( ) : <EOL> return unittest . makeSuite ( UnixCCompilerTestCase ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> run_unittest ( test_suite ( ) ) </s>
