Skip to content

test_keywords in test_popen can be improved #131234

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.

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

Closed
sobolevn opened this issue Mar 14, 2025 · 0 comments
Closed

test_keywords in test_popen can be improved #131234

sobolevn opened this issue Mar 14, 2025 · 0 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Mar 14, 2025

Bug report

test_keywords here:

def test_keywords(self):
with os.popen(cmd="exit 0", mode="w", buffering=-1):
pass

does not assert anything. I propose to use an example similar to this one:

def test_contextmanager(self):
with os.popen("echo hello") as f:
self.assertEqual(f.read(), "hello\n")

and at least assert that the expected program executed and that f is still not closed in with body.

I have a PR ready.

Linked PRs

@sobolevn sobolevn added tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error labels Mar 14, 2025
@sobolevn sobolevn self-assigned this Mar 14, 2025
sobolevn added a commit to sobolevn/cpython that referenced this issue Mar 14, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 14, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 14, 2025
sobolevn added a commit that referenced this issue Mar 14, 2025
…131241)

gh-131234: Improve `test_popen` with more asserts (GH-131235)
(cherry picked from commit fc07f86)

Co-authored-by: sobolevn <[email protected]>
sobolevn added a commit that referenced this issue Mar 14, 2025
…131240)

gh-131234: Improve `test_popen` with more asserts (GH-131235)
(cherry picked from commit fc07f86)

Co-authored-by: sobolevn <[email protected]>
mikec9 pushed a commit to mikec9/cpython that referenced this issue Mar 14, 2025
…nGH-131235) (python#131241)

pythongh-131234: Improve `test_popen` with more asserts (pythonGH-131235)
(cherry picked from commit fc07f86)

Co-authored-by: sobolevn <[email protected]>
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant