Skip to content
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

Prevent test_timeout from failing when a key is pressed #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danielparks
Copy link
Contributor

test_timeout() checks that the timeout parameter works by waiting on stdout to be ready for reading with a timeout of 1 ms. One might guess that stdout would never be ready for reading, but it appears that on macOS, at least, pressing enter while running the tests will cause stdout to be ready for reading, which in turn will cause the test to fail.

This switches test_timeout() to use UnixStream::pair() and just never write to the writer. This works even when keys are pressed while the tests are running.


Just got to say, stdout being ready for reading is super weird.

`test_timeout()` checks that the timeout parameter works by waiting on
stdout to be ready for reading with a timeout of 1 ms. One might guess
that stdout would never be ready for reading, but it appears that on
macOS, at least, pressing enter while running the tests will cause
stdout to be ready for reading, which in turn will cause the test to
fail.

This switches `test_timeout()` to use `UnixStream::pair()` and just
never write to the writer. This works even when keys are pressed while
the tests are running.
Copy link
Owner

@cloudhead cloudhead left a comment

Choose a reason for hiding this comment

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

Uh strange. This looks good though.

@danielparks
Copy link
Contributor Author

FWIW, I just confirmed the same behavior on Linux. ¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants