Steps and entrypoint to yield control from Kapow! handlers
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
|
||||
def before_scenario(context, scenario):
|
||||
# Create the request_handler FIFO
|
||||
while True:
|
||||
context.handler_fifo_path = tempfile.mktemp() # Safe because using
|
||||
# mkfifo
|
||||
try:
|
||||
os.mkfifo(context.handler_fifo_path)
|
||||
except OSError:
|
||||
# The file already exist
|
||||
pass
|
||||
else:
|
||||
break
|
||||
|
||||
|
||||
def after_scenario(context, scenario):
|
||||
if hasattr(context, 'server'):
|
||||
context.server.terminate()
|
||||
context.server.wait()
|
||||
|
||||
os.unlink(context.handler_fifo_path)
|
||||
|
||||
Reference in New Issue
Block a user