Skip to content

test_keywords in test_popen can be improved #131234

Closed
@sobolevn

Description

@sobolevn

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

Activity

added
testsTests in the Lib/test dir
type-bugAn unexpected behavior, bug, or error
on Mar 14, 2025
self-assigned this
on Mar 14, 2025
added a commit that references this issue on Mar 14, 2025

pythongh-131234: Improve `test_popen` with more asserts

b81d291
added a commit that references this issue on Mar 14, 2025

gh-131234: Improve `test_popen` with more asserts (#131235)

fc07f86
added 2 commits that reference this issue on Mar 14, 2025

pythongh-131234: Improve `test_popen` with more asserts (pythonGH-131235

pythongh-131234: Improve `test_popen` with more asserts (pythonGH-131235

added a commit that references this issue on Mar 14, 2025

[3.12] gh-131234: Improve `test_popen` with more asserts (GH-131235) (#…

9a612a8
added a commit that references this issue on Mar 14, 2025

[3.13] gh-131234: Improve `test_popen` with more asserts (GH-131235) (#…

a3ca70c
added a commit that references this issue on Mar 14, 2025

[3.12] pythongh-131234: Improve `test_popen` with more asserts (pytho…

added a commit that references this issue on Mar 17, 2025

pythongh-131234: Improve `test_popen` with more asserts (python#131235)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    `test_keywords` in `test_popen` can be improved · Issue #131234 · python/cpython