Skip to content

Commit

Permalink
test: quickly close pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
pajod committed Aug 23, 2024
1 parent 3a66cbd commit c15731e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/test_nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def {APP_FUNC_NAME}(environ, start_response):
("Content-Length", "%d" % len(body)),
]
start_response("200 OK", response_head)
time.sleep(0.1)
time.sleep(0.02)
return iter([body])
"""

Expand Down Expand Up @@ -204,6 +204,7 @@ def run(self):
bufsize=0, # allow read to return short
cwd=self.temp_path,
shell=False,
close_fds=True,
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
Expand All @@ -228,6 +229,8 @@ def graceful_quit(self, expect=None):
except subprocess.TimeoutExpired:
pass
assert stdout == b""
self.p.stdout.close()
self.p.stderr.close()
exitcode = self.p.poll() # will return None if running
assert exitcode == 0, (exitcode, stdout, stderr)
print("output after signal: ", stdout, stderr, exitcode)
Expand Down

0 comments on commit c15731e

Please sign in to comment.