mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #27472: Add test.support.unix_shell as the path to the default shell.
This commit is contained in:
parent
de85ed69f4
commit
d141531eb5
5 changed files with 24 additions and 13 deletions
|
@ -64,6 +64,7 @@ except ImportError:
|
|||
INT_MAX = PY_SSIZE_T_MAX = sys.maxsize
|
||||
|
||||
from test.support.script_helper import assert_python_ok
|
||||
from test.support import unix_shell
|
||||
|
||||
|
||||
root_in_posix = False
|
||||
|
@ -670,18 +671,20 @@ class EnvironTests(mapping_tests.BasicTestMappingProtocol):
|
|||
return os.environ
|
||||
|
||||
# Bug 1110478
|
||||
@unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
|
||||
@unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
|
||||
'requires a shell')
|
||||
def test_update2(self):
|
||||
os.environ.clear()
|
||||
os.environ.update(HELLO="World")
|
||||
with os.popen("/bin/sh -c 'echo $HELLO'") as popen:
|
||||
with os.popen("%s -c 'echo $HELLO'" % unix_shell) as popen:
|
||||
value = popen.read().strip()
|
||||
self.assertEqual(value, "World")
|
||||
|
||||
@unittest.skipUnless(os.path.exists('/bin/sh'), 'requires /bin/sh')
|
||||
@unittest.skipUnless(unix_shell and os.path.exists(unix_shell),
|
||||
'requires a shell')
|
||||
def test_os_popen_iter(self):
|
||||
with os.popen(
|
||||
"/bin/sh -c 'echo \"line1\nline2\nline3\"'") as popen:
|
||||
with os.popen("%s -c 'echo \"line1\nline2\nline3\"'"
|
||||
% unix_shell) as popen:
|
||||
it = iter(popen)
|
||||
self.assertEqual(next(it), "line1\n")
|
||||
self.assertEqual(next(it), "line2\n")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue