MCPcopy Index your code
hub / github.com/python/cpython / test_run_with_pathlike_path

Method test_run_with_pathlike_path

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

Source from the content-addressed store, hash-verified

1878 self.assertEqual(cp.returncode, 33)
1879
1880 def test_run_with_pathlike_path(self):
1881 # bpo-31961: test run(pathlike_object)
1882 # the name of a command that can be run without
1883 # any arguments that exit fast
1884 prog = 'tree.com' if mswindows else 'ls'
1885 path = shutil.which(prog)
1886 if path is None:
1887 self.skipTest(f'{prog} required for this test')
1888 path = FakePath(path)
1889 res = subprocess.run(path, stdout=subprocess.DEVNULL)
1890 self.assertEqual(res.returncode, 0)
1891 with self.assertRaises(TypeError):
1892 subprocess.run(path, stdout=subprocess.DEVNULL, shell=True)
1893
1894 def test_run_with_bytes_path_and_arguments(self):
1895 # bpo-31961: test run([bytes_object, b'additional arguments'])

Callers

nothing calls this directly

Calls 5

FakePathClass · 0.90
skipTestMethod · 0.80
runMethod · 0.45
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected