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

Side by Side Diff: Lib/distutils/tests/test_spawn.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/distutils/tests/test_install.py ('k') | Lib/distutils/tests/test_sysconfig.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 """Tests for distutils.spawn.""" 1 """Tests for distutils.spawn."""
2 import unittest 2 import unittest
3 import os 3 import os
4 import time 4 from test.support import run_unittest
5 from test.support import captured_stdout, run_unittest
6 5
7 from distutils.spawn import _nt_quote_args 6 from distutils.spawn import _nt_quote_args
8 from distutils.spawn import spawn, find_executable 7 from distutils.spawn import spawn
9 from distutils.errors import DistutilsExecError 8 from distutils.errors import DistutilsExecError
10 from distutils.tests import support 9 from distutils.tests import support
11 10
12 class SpawnTestCase(support.TempdirManager, 11 class SpawnTestCase(support.TempdirManager,
13 support.LoggingSilencer, 12 support.LoggingSilencer,
14 unittest.TestCase): 13 unittest.TestCase):
15 14
16 def test_nt_quote_args(self): 15 def test_nt_quote_args(self):
17 16
18 for (args, wanted) in ((['with space', 'nospace'], 17 for (args, wanted) in ((['with space', 'nospace'],
19 ['"with space"', 'nospace']), 18 ['"with space"', 'nospace']),
20 (['nochange', 'nospace'], 19 (['nochange', 'nospace'],
21 ['nochange', 'nospace'])): 20 ['nochange', 'nospace'])):
22 res = _nt_quote_args(args) 21 res = _nt_quote_args(args)
23 self.assertEqual(res, wanted) 22 self.assertEqual(res, wanted)
24 23
25 24 @unittest.skipUnless(os.name == 'nt' or (os.name == 'posix' and hasattr(os, 'fork')), "distutils cannot spawn child processes")
26 @unittest.skipUnless(os.name in ('nt', 'posix'),
27 'Runs only under posix or nt')
28 def test_spawn(self): 25 def test_spawn(self):
29 tmpdir = self.mkdtemp() 26 tmpdir = self.mkdtemp()
30 27
31 # creating something executable 28 # creating something executable
32 # through the shell that returns 1 29 # through the shell that returns 1
33 if os.name == 'posix': 30 if os.name == 'posix':
34 exe = os.path.join(tmpdir, 'foo.sh') 31 exe = os.path.join(tmpdir, 'foo.sh')
35 self.write_file(exe, '#!/bin/sh\nexit 1') 32 self.write_file(exe, '#!/bin/sh\nexit 1')
36 else: 33 else:
37 exe = os.path.join(tmpdir, 'foo.bat') 34 exe = os.path.join(tmpdir, 'foo.bat')
(...skipping 11 matching lines...) Expand all
49 self.write_file(exe, 'exit 0') 46 self.write_file(exe, 'exit 0')
50 47
51 os.chmod(exe, 0o777) 48 os.chmod(exe, 0o777)
52 spawn([exe]) # should work without any error 49 spawn([exe]) # should work without any error
53 50
54 def test_suite(): 51 def test_suite():
55 return unittest.makeSuite(SpawnTestCase) 52 return unittest.makeSuite(SpawnTestCase)
56 53
57 if __name__ == "__main__": 54 if __name__ == "__main__":
58 run_unittest(test_suite()) 55 run_unittest(test_suite())
OLDNEW
« no previous file with comments | « Lib/distutils/tests/test_install.py ('k') | Lib/distutils/tests/test_sysconfig.py » ('j') | no next file with comments »

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