MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_specific_shell

Method test_specific_shell

Lib/test/test_subprocess.py:2545–2563  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2543 self.assertEqual(rc, 47)
2544
2545 def test_specific_shell(self):
2546 # Issue #9265: Incorrect name passed as arg[0].
2547 shells = []
2548 for prefix in ['/bin', '/usr/bin/', '/usr/local/bin']:
2549 for name in ['bash', 'ksh']:
2550 sh = os.path.join(prefix, name)
2551 if os.path.isfile(sh):
2552 shells.append(sh)
2553 if not shells: # Will probably work for any shell but csh.
2554 self.skipTest("bash or ksh required for this test")
2555 sh = '/bin/sh'
2556 if os.path.isfile(sh) and not os.path.islink(sh):
2557 # Test will fail if /bin/sh is a symlink to csh.
2558 shells.append(sh)
2559 for sh in shells:
2560 p = subprocess.Popen("echo $0", executable=sh, shell=True,
2561 stdout=subprocess.PIPE)
2562 with p:
2563 self.assertEqual(p.stdout.read().strip(), bytes(sh, 'ascii'))
2564
2565 def _kill_process(self, method, *args):
2566 # Do not inherit file handles from the parent.

Callers

nothing calls this directly

Calls 8

skipTestMethod · 0.80
islinkMethod · 0.80
joinMethod · 0.45
isfileMethod · 0.45
appendMethod · 0.45
assertEqualMethod · 0.45
stripMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected