mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2024-11-24 21:23:22 +00:00
feat: Add bottle webserver to run along with tests
This commit is contained in:
parent
5b571aa166
commit
bf417f50a4
4 changed files with 28 additions and 0 deletions
1
setup.py
1
setup.py
|
@ -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
19
tests/conftest.py
Normal 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()
|
||||
|
0
tests/mock_server/__init__.py
Normal file
0
tests/mock_server/__init__.py
Normal file
8
tests/mock_server/server.py
Normal file
8
tests/mock_server/server.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
from bottle import route, run
|
||||
|
||||
@route('/')
|
||||
def index():
|
||||
return "Hello"
|
||||
|
||||
def start():
|
||||
run(host='localhost', port=8080)
|
Loading…
Reference in a new issue