mirror of
https://github.com/pirate/ArchiveBox.git
synced 2025-08-22 14:13:01 +02:00
feat: Add bottle webserver to run along with tests
This commit is contained in:
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)
|
Reference in New Issue
Block a user