def test_Popen_defaults(self):
results = self._fake_subprocess_Popen()
proc = subprocess2.Popen(['foo'], a=True)
# Cleanup code in subprocess.py needs this member to be set.
# pylint: disable=attribute-defined-outside-init
proc._child_created = None
expected = {
'args': ['foo'],
'a': True,
'shell': bool(sys.platform=='win32'),
}
if sys.platform != 'win32':
env = os.environ.copy()
is_english = lambda name: env.get(name, 'en').startswith('en')
if not is_english('LANG'):
env['LANG'] = 'en_US.UTF-8'
expected['env'] = env
if not is_english('LANGUAGE'):
env['LANGUAGE'] = 'en_US.UTF-8'
expected['env'] = env
self.assertEquals(expected, results)
self.assertTrue(time.time() >= proc.start)
评论列表
文章目录