Skip to content

test_keywords in test_popen can be improved #131234

Closed

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

  1. added
    testsTests in the Lib/test dir
    type-bugAn unexpected behavior, bug, or error
    on Mar 14, 2025
  2. self-assigned this
    on Mar 14, 2025
  3. added 2 commits that reference this issue on Mar 14, 2025
  4. added 2 commits that reference this issue on Mar 14, 2025
  5. added a commit that references this issue on Mar 14, 2025
  6. added a commit that references this issue on Mar 14, 2025
  7. added a commit that references this issue on Mar 14, 2025
  8. added a commit that references this issue on Mar 17, 2025
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