Skip to content

test_keywords in test_popen can be improved #131234

@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

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