- Notifications
You must be signed in to change notification settings - Fork 45
Add main_thread_only execmodel #243
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
| @@ -249,12 +249,25 @@ class Arg: | |
| ||
@pytest.mark.skipif("not hasattr(os, 'dup')") | ||
def test_stdouterrin_setnull(execmodel, capfd): | ||
gateway_base.init_popen_io(execmodel) | ||
os.write(1, b"hello") | ||
os.read(0, 1) | ||
out, err = capfd.readouterr() | ||
assert not out | ||
assert not err | ||
# Backup and restore stdin state, and rely on capfd to handle | ||
# this for stdout and stderr. | ||
orig_stdin = sys.stdin | ||
orig_stdin_fd = os.dup(0) | ||
try: | ||
# The returned Popen2IO instance can be garbage collected | ||
# prematurely since we don't hold a reference here, but we | ||
# tolerate this because it is intended to leave behind a | ||
# sane state afterwards. | ||
gateway_base.init_popen_io(execmodel) | ||
os.write(1, b"hello") | ||
os.read(0, 1) | ||
out, err = capfd.readouterr() | ||
assert not out | ||
assert not err | ||
finally: | ||
sys.stdin = orig_stdin | ||
os.dup2(orig_stdin_fd, 0) | ||
os.close(orig_stdin_fd) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When I run the full test suite in a local venv including eventlet and gevent, for some reason without this stdin restoration test_stdouterrin_setnull tends trigger the "Bad file descriptor" error just for gevent which runs last. I don't understand why that happens even with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are some occasional issues with coordination of gevent - the patching of stdio with fdopen of gevent is trouble in some cases There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in particular in the cases where it collides with pytest stdio capture | ||
| ||
| ||
class PseudoChannel: | ||
|
Uh oh!
There was an error while loading. Please reload this page.