summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_ccompiler.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_ccompiler.py')
-rw-r--r--Lib/distutils/tests/test_ccompiler.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/Lib/distutils/tests/test_ccompiler.py b/Lib/distutils/tests/test_ccompiler.py
index 9db8d24..27b51a0 100644
--- a/Lib/distutils/tests/test_ccompiler.py
+++ b/Lib/distutils/tests/test_ccompiler.py
@@ -3,8 +3,10 @@ import os
import unittest
from test.support import captured_stdout
-from distutils.ccompiler import gen_lib_options, CCompiler
+from distutils.ccompiler import (gen_lib_options, CCompiler,
+ get_default_compiler, customize_compiler)
from distutils import debug
+from distutils.tests import support
class FakeCompiler(object):
def library_dir_option(self, dir):
@@ -19,7 +21,7 @@ class FakeCompiler(object):
def library_option(self, lib):
return "-l" + lib
-class CCompilerTestCase(unittest.TestCase):
+class CCompilerTestCase(support.EnvironGuard, unittest.TestCase):
def test_gen_lib_options(self):
compiler = FakeCompiler()
@@ -52,6 +54,26 @@ class CCompilerTestCase(unittest.TestCase):
finally:
debug.DEBUG = False
+ def test_customize_compiler(self):
+
+ # not testing if default compiler is not unix
+ if get_default_compiler() != 'unix':
+ return
+
+ os.environ['AR'] = 'my_ar'
+ os.environ['ARFLAGS'] = '-arflags'
+
+ # make sure AR gets caught
+ class compiler:
+ compiler_type = 'unix'
+
+ def set_executables(self, **kw):
+ self.exes = kw
+
+ comp = compiler()
+ customize_compiler(comp)
+ self.assertEquals(comp.exes['archiver'], 'my_ar -arflags')
+
def test_suite():
return unittest.makeSuite(CCompilerTestCase)