feat: Add bottle webserver to run along with tests

This commit is contained in:
Cristian 2020-07-07 14:46:45 -05:00
parent 5b571aa166
commit bf417f50a4
4 changed files with 28 additions and 0 deletions

View file

@ -65,6 +65,7 @@ setuptools.setup(
"sphinx-rtd-theme",
"recommonmark",
"pytest",
"bottle",
],
# 'redis': ['redis', 'django-redis'],
# 'pywb': ['pywb', 'redis'],

19
tests/conftest.py Normal file
View file

@ -0,0 +1,19 @@
from multiprocessing import Process
import pytest
from .mock_server.server import start
server_process = None
@pytest.hookimpl
def pytest_sessionstart(session):
global server_process
server_process = Process(target=start)
server_process.start()
@pytest.hookimpl
def pytest_sessionfinish(session):
if server_process is not None:
server_process.terminate()
server_process.join()

View file

View file

@ -0,0 +1,8 @@
from bottle import route, run
@route('/')
def index():
return "Hello"
def start():
run(host='localhost', port=8080)