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

Conversation

Eclips4
Copy link
Member

@Eclips4 Eclips4 commented Jan 27, 2024

From name of test (test_spawn_doesnt_hang) I can assume that purpose of this test - check that spawn doesn't hang, so I had chosen this approach.
Another approach may be the same as in #114565.

@bedevere-app bedevere-app bot added the tests Tests in the Lib/test dir label Jan 27, 2024
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants