Skip to content

gh-114100: Replace print in test_pty with a simple expression #114645

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
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib/test/test_pty.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def test_master_read(self):
self.assertEqual(data, b"")

def test_spawn_doesnt_hang(self):
pty.spawn([sys.executable, '-c', 'print("hi there")'])
pty.spawn([sys.executable, '-c', '1 + 1'])
Copy link
Member

Choose a reason for hiding this comment

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

It may be a part of the manual testing. pty.spawn() runs subprocess and copy its stdout to this process stdout (fileno 1). The change that added this test ensured that pty.spawn() returns when reading from child returns empty bytes. But this test can implicitly test that pty.spawn() works at all and does not return before copying all child's output to stdout.

I try to automate this in #114647.


class SmallPtyTests(unittest.TestCase):
"""These tests don't spawn children or hang."""
Expand Down