OLD | NEW |
1 """Tests for distutils.sysconfig.""" | 1 """Tests for distutils.sysconfig.""" |
2 import os | 2 import os |
3 import test | 3 import test |
4 import unittest | 4 import unittest |
5 | 5 |
6 from distutils import sysconfig | 6 from distutils import sysconfig |
7 from distutils.ccompiler import get_default_compiler | 7 from distutils.ccompiler import get_default_compiler |
8 from distutils.tests import support | 8 from distutils.tests import support |
9 from test.support import TESTFN, run_unittest | 9 from test.support import TESTFN, run_unittest |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 # make sure AR gets caught | 64 # make sure AR gets caught |
65 class compiler: | 65 class compiler: |
66 compiler_type = 'unix' | 66 compiler_type = 'unix' |
67 | 67 |
68 def set_executables(self, **kw): | 68 def set_executables(self, **kw): |
69 self.exes = kw | 69 self.exes = kw |
70 | 70 |
71 comp = compiler() | 71 comp = compiler() |
72 sysconfig.customize_compiler(comp) | 72 sysconfig.customize_compiler(comp) |
73 self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') | 73 self.assertEqual(comp.exes['archiver'], 'my_ar -arflags') |
74 | 74 |
75 def test_parse_makefile_base(self): | 75 def test_parse_makefile_base(self): |
76 self.makefile = TESTFN | 76 self.makefile = TESTFN |
77 fd = open(self.makefile, 'w') | 77 fd = open(self.makefile, 'w') |
78 try: | 78 try: |
79 fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n') | 79 fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n') |
80 fd.write('VAR=$OTHER\nOTHER=foo') | 80 fd.write('VAR=$OTHER\nOTHER=foo') |
81 finally: | 81 finally: |
82 fd.close() | 82 fd.close() |
83 d = sysconfig.parse_makefile(self.makefile) | 83 d = sysconfig.parse_makefile(self.makefile) |
84 self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", | 84 self.assertEqual(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", |
85 'OTHER': 'foo'}) | 85 'OTHER': 'foo'}) |
86 | 86 |
87 def test_parse_makefile_literal_dollar(self): | 87 def test_parse_makefile_literal_dollar(self): |
88 self.makefile = TESTFN | 88 self.makefile = TESTFN |
89 fd = open(self.makefile, 'w') | 89 fd = open(self.makefile, 'w') |
90 try: | 90 try: |
91 fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') | 91 fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') |
92 fd.write('VAR=$OTHER\nOTHER=foo') | 92 fd.write('VAR=$OTHER\nOTHER=foo') |
93 finally: | 93 finally: |
94 fd.close() | 94 fd.close() |
95 d = sysconfig.parse_makefile(self.makefile) | 95 d = sysconfig.parse_makefile(self.makefile) |
96 self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", | 96 self.assertEqual(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", |
97 'OTHER': 'foo'}) | 97 'OTHER': 'foo'}) |
98 | 98 |
99 | 99 |
100 def test_sysconfig_module(self): | 100 def test_sysconfig_module(self): |
101 import sysconfig as global_sysconfig | 101 import sysconfig as global_sysconfig |
102 self.assertEquals(global_sysconfig.get_config_var('CFLAGS'), sysconfig.g
et_config_var('CFLAGS')) | 102 self.assertEqual(global_sysconfig.get_config_var('CFLAGS'), sysconfig.ge
t_config_var('CFLAGS')) |
103 self.assertEquals(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.
get_config_var('LDFLAGS')) | 103 self.assertEqual(global_sysconfig.get_config_var('LDFLAGS'), sysconfig.g
et_config_var('LDFLAGS')) |
104 self.assertEquals(global_sysconfig.get_config_var('LDSHARED'),sysconfig.
get_config_var('LDSHARED')) | 104 self.assertEqual(global_sysconfig.get_config_var('LDSHARED'),sysconfig.g
et_config_var('LDSHARED')) |
105 self.assertEquals(global_sysconfig.get_config_var('CC'), sysconfig.get_c
onfig_var('CC')) | 105 self.assertEqual(global_sysconfig.get_config_var('CC'), sysconfig.get_co
nfig_var('CC')) |
106 | 106 |
107 | 107 |
108 | 108 |
109 def test_suite(): | 109 def test_suite(): |
110 suite = unittest.TestSuite() | 110 suite = unittest.TestSuite() |
111 suite.addTest(unittest.makeSuite(SysconfigTestCase)) | 111 suite.addTest(unittest.makeSuite(SysconfigTestCase)) |
112 return suite | 112 return suite |
113 | 113 |
114 | 114 |
115 if __name__ == '__main__': | 115 if __name__ == '__main__': |
116 run_unittest(test_suite()) | 116 run_unittest(test_suite()) |
OLD | NEW |