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

Method test_cwd_with_absolute_arg

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

Source from the content-addressed store, hash-verified

499 cwd=python_dir)
500
501 def test_cwd_with_absolute_arg(self):
502 # Check that Popen can find the executable when the cwd is wrong
503 # if args[0] is an absolute path.
504 python_dir, python_base = self._split_python_path()
505 abs_python = os.path.join(python_dir, python_base)
506 rel_python = os.path.join(os.curdir, python_base)
507 with os_helper.temp_dir() as wrong_dir:
508 # Before calling with an absolute path, confirm that using a
509 # relative path fails.
510 self.assertRaises(FileNotFoundError, subprocess.Popen,
511 [rel_python], cwd=wrong_dir)
512 wrong_dir = self._normalize_cwd(wrong_dir)
513 self._assert_cwd(wrong_dir, abs_python, cwd=wrong_dir)
514
515 @unittest.skipIf(sys.base_prefix != sys.prefix,
516 'Test is not venv-compatible')

Callers

nothing calls this directly

Calls 6

_split_python_pathMethod · 0.95
_normalize_cwdMethod · 0.95
_assert_cwdMethod · 0.95
temp_dirMethod · 0.80
joinMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected