summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/tests/test_sysconfig.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/tests/test_sysconfig.py')
-rw-r--r--Lib/distutils/tests/test_sysconfig.py37
1 files changed, 30 insertions, 7 deletions
diff --git a/Lib/distutils/tests/test_sysconfig.py b/Lib/distutils/tests/test_sysconfig.py
index 9496950..edc755e 100644
--- a/Lib/distutils/tests/test_sysconfig.py
+++ b/Lib/distutils/tests/test_sysconfig.py
@@ -2,9 +2,9 @@
import os
import test
import unittest
-import shutil
from distutils import sysconfig
+from distutils.ccompiler import get_default_compiler
from distutils.tests import support
from test.support import TESTFN, run_unittest
@@ -26,7 +26,10 @@ class SysconfigTestCase(support.EnvironGuard,
elif os.path.isdir(TESTFN):
shutil.rmtree(TESTFN)
- @support.capture_warnings
+ def test_get_config_h_filename(self):
+ config_h = sysconfig.get_config_h_filename()
+ self.assertTrue(os.path.isfile(config_h), config_h)
+
def test_get_python_lib(self):
lib_dir = sysconfig.get_python_lib()
# XXX doesn't work on Linux when Python was never installed before
@@ -34,11 +37,7 @@ class SysconfigTestCase(support.EnvironGuard,
# test for pythonxx.lib?
self.assertNotEqual(sysconfig.get_python_lib(),
sysconfig.get_python_lib(prefix=TESTFN))
- _sysconfig = __import__('sysconfig')
- res = sysconfig.get_python_lib(True, True)
- self.assertEquals(_sysconfig.get_path('platstdlib'), res)
- @support.capture_warnings
def test_get_python_inc(self):
inc_dir = sysconfig.get_python_inc()
# This is not much of a test. We make sure Python.h exists
@@ -48,7 +47,31 @@ class SysconfigTestCase(support.EnvironGuard,
python_h = os.path.join(inc_dir, "Python.h")
self.assertTrue(os.path.isfile(python_h), python_h)
- @support.capture_warnings
+ def test_get_config_vars(self):
+ cvars = sysconfig.get_config_vars()
+ self.assertTrue(isinstance(cvars, dict))
+ self.assertTrue(cvars)
+
+ 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()
+ sysconfig.customize_compiler(comp)
+ self.assertEquals(comp.exes['archiver'], 'my_ar -arflags')
+
def test_parse_makefile_base(self):
self.makefile = TESTFN
fd = open(self.makefile, 'w')