Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(125979)

Side by Side Diff: Lib/distutils/tests/test_build_ext.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/ctypes/util.py ('k') | Lib/distutils/tests/test_build_py.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import sys 1 import sys
2 import os 2 import os
3 from io import StringIO 3 from io import StringIO
4 import textwrap 4 import textwrap
5 5
6 from distutils.core import Distribution 6 from distutils.core import Distribution
7 from distutils.command.build_ext import build_ext 7 from distutils.command.build_ext import build_ext
8 from distutils import sysconfig 8 from distutils import sysconfig
9 from distutils.tests.support import (TempdirManager, LoggingSilencer, 9 from distutils.tests.support import (TempdirManager, LoggingSilencer,
10 copy_xxmodule_c, fixup_build_ext) 10 copy_xxmodule_c, fixup_build_ext)
(...skipping 22 matching lines...) Expand all
33 sys.path.append(self.tmp_dir) 33 sys.path.append(self.tmp_dir)
34 import site 34 import site
35 self.old_user_base = site.USER_BASE 35 self.old_user_base = site.USER_BASE
36 site.USER_BASE = self.mkdtemp() 36 site.USER_BASE = self.mkdtemp()
37 from distutils.command import build_ext 37 from distutils.command import build_ext
38 build_ext.USER_BASE = site.USER_BASE 38 build_ext.USER_BASE = site.USER_BASE
39 39
40 def build_ext(self, *args, **kwargs): 40 def build_ext(self, *args, **kwargs):
41 return build_ext(*args, **kwargs) 41 return build_ext(*args, **kwargs)
42 42
43 @unittest.skipUnless(os.name == 'nt' or (os.name == 'posix' and hasattr(os, 'fork')), "distutils cannot spawn child processes")
43 def test_build_ext(self): 44 def test_build_ext(self):
44 global ALREADY_TESTED 45 global ALREADY_TESTED
45 copy_xxmodule_c(self.tmp_dir) 46 copy_xxmodule_c(self.tmp_dir)
46 xx_c = os.path.join(self.tmp_dir, 'xxmodule.c') 47 xx_c = os.path.join(self.tmp_dir, 'xxmodule.c')
47 xx_ext = Extension('xx', [xx_c]) 48 xx_ext = Extension('xx', [xx_c])
48 dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]}) 49 dist = Distribution({'name': 'xx', 'ext_modules': [xx_ext]})
49 dist.package_dir = self.tmp_dir 50 dist.package_dir = self.tmp_dir
50 cmd = self.build_ext(dist) 51 cmd = self.build_ext(dist)
51 fixup_build_ext(cmd) 52 fixup_build_ext(cmd)
52 cmd.build_lib = self.tmp_dir 53 cmd.build_lib = self.tmp_dir
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 # cmd.compiler is an option and 282 # cmd.compiler is an option and
282 # should not be overriden by a compiler instance 283 # should not be overriden by a compiler instance
283 # when the command is run 284 # when the command is run
284 dist = Distribution() 285 dist = Distribution()
285 cmd = self.build_ext(dist) 286 cmd = self.build_ext(dist)
286 cmd.compiler = 'unix' 287 cmd.compiler = 'unix'
287 cmd.ensure_finalized() 288 cmd.ensure_finalized()
288 cmd.run() 289 cmd.run()
289 self.assertEqual(cmd.compiler, 'unix') 290 self.assertEqual(cmd.compiler, 'unix')
290 291
292 @unittest.skipUnless(os.name == 'nt' or (os.name == 'posix' and hasattr(os, 'fork')), "distutils cannot spawn child processes")
291 def test_get_outputs(self): 293 def test_get_outputs(self):
292 tmp_dir = self.mkdtemp() 294 tmp_dir = self.mkdtemp()
293 c_file = os.path.join(tmp_dir, 'foo.c') 295 c_file = os.path.join(tmp_dir, 'foo.c')
294 self.write_file(c_file, 'void PyInit_foo(void) {}\n') 296 self.write_file(c_file, 'void PyInit_foo(void) {}\n')
295 ext = Extension('foo', [c_file], optional=False) 297 ext = Extension('foo', [c_file], optional=False)
296 dist = Distribution({'name': 'xx', 298 dist = Distribution({'name': 'xx',
297 'ext_modules': [ext]}) 299 'ext_modules': [ext]})
298 cmd = self.build_ext(dist) 300 cmd = self.build_ext(dist)
299 fixup_build_ext(cmd) 301 fixup_build_ext(cmd)
300 cmd.ensure_finalized() 302 cmd.ensure_finalized()
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 495
494 496
495 def test_suite(): 497 def test_suite():
496 suite = unittest.TestSuite() 498 suite = unittest.TestSuite()
497 suite.addTest(unittest.makeSuite(BuildExtTestCase)) 499 suite.addTest(unittest.makeSuite(BuildExtTestCase))
498 suite.addTest(unittest.makeSuite(ParallelBuildExtTestCase)) 500 suite.addTest(unittest.makeSuite(ParallelBuildExtTestCase))
499 return suite 501 return suite
500 502
501 if __name__ == '__main__': 503 if __name__ == '__main__':
502 support.run_unittest(__name__) 504 support.run_unittest(__name__)
OLDNEW
« no previous file with comments | « Lib/ctypes/util.py ('k') | Lib/distutils/tests/test_build_py.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+