Created
March 27, 2014 02:56
-
-
Save kevinjqiu/9799173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pretenders.server.server import run | |
import multiprocessing | |
ml = multiprocessing.Process(name='ml', target=run) | |
ml.start() | |
def _init(): | |
from pretenders.client.http import HTTPMock | |
from pretenders.constants import FOREVER | |
retry = 10 | |
while True: | |
try: | |
m = HTTPMock('localhost', 8000, name='ml') | |
break | |
except: | |
retry -= 1 | |
if retry == 0: | |
raise | |
m.when('GET /ping').reply(body='pong', times=FOREVER) | |
init = multiprocessing.Process(name='init', target=_init) | |
init.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment