GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-28624: Add test for subprocess to check that cmd arg supports PathLike by sayanchowdhury · Pull Request #157 · python/cpython

bpo-28624: Add test for subprocess to check that cmd arg supports PathLike #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
berkerpeksag merged 3 commits into python:master from sayanchowdhury:bpo28624
Feb 26, 2017

Uh oh!

There was an error while loading. Please reload this page.

Merged

bpo-28624: Add test for subprocess to check that cmd arg supports PathLike #157

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3 commits
Select commit Hold shift + click to select a range
3370e0b
bpo-28624: Add test for Popen to check that cmd arg supports PathLike
sayanchowdhury Feb 19, 2017
0b2c42b
Move NEWS entry
berkerpeksag Feb 26, 2017
bfd7de3
Merge branch 'master' into bpo28624
berkerpeksag Feb 26, 2017
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view

There are no files selected for viewing

10 changes: 7 additions & 3 deletions 10 Doc/library/subprocess.rst
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,13 @@ functions.
The *pass_fds* parameter was added.

If *cwd* is not ``None``, the function changes the working directory to
*cwd* before executing the child. In particular, the function looks for
*executable* (or for the first item in *args*) relative to *cwd* if the
executable path is a relative path.
*cwd* before executing the child. *cwd* can be a :class:`str` and
:term:`path-like <path-like object>` object. In particular, the function
Comment thread Outdated

@zhangyangyu zhangyangyu Feb 22, 2017

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you only mention string and PathLike, how about bytes? Is it acceptable?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@sayanchowdhury sayanchowdhury Feb 26, 2017

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test for bytes too and it's seems to be passing too. Also updated the docs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
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
SIG_IGN are restored to SIG_DFL in the child process before the exec.
Expand Down
10 changes: 10 additions & 0 deletions 10 Lib/test/test_subprocess.py
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ def test_cwd(self):
temp_dir = self._normalize_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")
def test_cwd_with_relative_arg(self):
# Check that Popen looks for args[0] relative to cwd if args[0]
Expand Down
1 change: 1 addition & 0 deletions 1 Misc/ACKS
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ Albert Chin-A-Young
Adal Chiriliuc
Matt Chisholm
Lita Cho
Sayan Chowdhury
Anders Chrigström
Tom Christiansen
Renee Chu
Expand Down
3 changes: 3 additions & 0 deletions 3 Misc/NEWS
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ Extension Modules
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.
Patch by Aviv Palivoda.

Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.