mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
bpo-28624: Add a test that checks that cwd parameter of Popen() accepts PathLike objects (#157)
This commit is contained in:
parent
6b4a5f45e2
commit
d5c11f7ace
4 changed files with 21 additions and 3 deletions
|
@ -466,9 +466,13 @@ functions.
|
||||||
The *pass_fds* parameter was added.
|
The *pass_fds* parameter was added.
|
||||||
|
|
||||||
If *cwd* is not ``None``, the function changes the working directory to
|
If *cwd* is not ``None``, the function changes the working directory to
|
||||||
*cwd* before executing the child. In particular, the function looks for
|
*cwd* before executing the child. *cwd* can be a :class:`str` and
|
||||||
*executable* (or for the first item in *args*) relative to *cwd* if the
|
:term:`path-like <path-like object>` object. In particular, the function
|
||||||
executable path is a relative path.
|
looks for *executable* (or for the first item in *args*) relative to *cwd*
|
||||||
|
if the executable path is a relative path.
|
||||||
|
|
||||||
|
.. versionchanged:: 3.6
|
||||||
|
*cwd* parameter accepts a :term:`path-like object`.
|
||||||
|
|
||||||
If *restore_signals* is true (the default) all signals that Python has set to
|
If *restore_signals* is true (the default) all signals that Python has set to
|
||||||
SIG_IGN are restored to SIG_DFL in the child process before the exec.
|
SIG_IGN are restored to SIG_DFL in the child process before the exec.
|
||||||
|
|
|
@ -347,6 +347,16 @@ class ProcessTestCase(BaseTestCase):
|
||||||
temp_dir = self._normalize_cwd(temp_dir)
|
temp_dir = self._normalize_cwd(temp_dir)
|
||||||
self._assert_cwd(temp_dir, sys.executable, cwd=temp_dir)
|
self._assert_cwd(temp_dir, sys.executable, cwd=temp_dir)
|
||||||
|
|
||||||
|
def test_cwd_with_pathlike(self):
|
||||||
|
temp_dir = tempfile.gettempdir()
|
||||||
|
temp_dir = self._normalize_cwd(temp_dir)
|
||||||
|
|
||||||
|
class _PathLikeObj:
|
||||||
|
def __fspath__(self):
|
||||||
|
return temp_dir
|
||||||
|
|
||||||
|
self._assert_cwd(temp_dir, sys.executable, cwd=_PathLikeObj())
|
||||||
|
|
||||||
@unittest.skipIf(mswindows, "pending resolution of issue #15533")
|
@unittest.skipIf(mswindows, "pending resolution of issue #15533")
|
||||||
def test_cwd_with_relative_arg(self):
|
def test_cwd_with_relative_arg(self):
|
||||||
# Check that Popen looks for args[0] relative to cwd if args[0]
|
# Check that Popen looks for args[0] relative to cwd if args[0]
|
||||||
|
|
|
@ -269,6 +269,7 @@ Albert Chin-A-Young
|
||||||
Adal Chiriliuc
|
Adal Chiriliuc
|
||||||
Matt Chisholm
|
Matt Chisholm
|
||||||
Lita Cho
|
Lita Cho
|
||||||
|
Sayan Chowdhury
|
||||||
Anders Chrigström
|
Anders Chrigström
|
||||||
Tom Christiansen
|
Tom Christiansen
|
||||||
Renee Chu
|
Renee Chu
|
||||||
|
|
|
@ -249,6 +249,9 @@ Extension Modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- bpo-28624: Add a test that checks that cwd parameter of Popen() accepts
|
||||||
|
PathLike objects. Patch by Sayan Chowdhury.
|
||||||
|
|
||||||
- bpo-28518: Start a transaction implicitly before a DML statement.
|
- bpo-28518: Start a transaction implicitly before a DML statement.
|
||||||
Patch by Aviv Palivoda.
|
Patch by Aviv Palivoda.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue