Steps and entrypoint to yield control from Kapow! handlers

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-08-29 16:22:57 +02:00
parent ed00f2c3d7
commit b8d76e0aca
3 changed files with 82 additions and 4 deletions
+20
View File
@@ -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)