def devserver(port):
config.rc_root = 'http://localhost:{}'.format(port)
config.rc_api_root = config.rc_root + '/api/v1'
proc = subprocess.Popen(
['python', 'devserver/__init__.py'],
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
env={**os.environ, 'PORT': str(port)}
)
# wait for the dev server to come up
time.sleep(1)
try:
yield
finally:
proc.kill()
proc.wait()
评论列表
文章目录