added coverage.process_startup for multiprocessing coverage... but does not quite work yet
This commit is contained in:
parent
da9b3d0cb9
commit
2b48c6108b
@ -8,6 +8,8 @@ PACKAGE_ROOT_DIR = MODULE_DIR.parents[0]
|
||||
|
||||
CONFIG_FILE = PACKAGE_ROOT_DIR / "config.yaml"
|
||||
|
||||
COVERAGERC = str(PACKAGE_ROOT_DIR / ".coveragerc")
|
||||
|
||||
BANNER_FILE = PACKAGE_ROOT_DIR / "banner.txt"
|
||||
|
||||
DATA_DIR = PACKAGE_ROOT_DIR / "data"
|
||||
|
||||
@ -23,3 +23,4 @@ pytest~=7.1.0
|
||||
funcy==1.17
|
||||
PyMuPDF==1.19.6
|
||||
fpdf==1.7.2
|
||||
coverage==6.3.2
|
||||
|
||||
@ -1,12 +1,16 @@
|
||||
import os
|
||||
import socket
|
||||
from multiprocessing import Process
|
||||
from time import sleep
|
||||
|
||||
import coverage
|
||||
import pytest
|
||||
import requests
|
||||
from funcy import retry, complement
|
||||
from funcy import retry
|
||||
|
||||
from image_prediction.flask import make_prediction_server, run_prediction_server
|
||||
from image_prediction.locations import COVERAGERC
|
||||
|
||||
# os.environ['COVERAGE_PROCESS_START'] = COVERAGERC
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -59,6 +63,7 @@ def server_ready(url):
|
||||
@pytest.fixture(autouse=True, scope="function")
|
||||
def server_process(server, host_and_port, url):
|
||||
def get_server_process():
|
||||
coverage.process_startup()
|
||||
return Process(target=run_prediction_server, kwargs={"app": server, **host_and_port})
|
||||
|
||||
server = get_server_process()
|
||||
@ -67,7 +72,9 @@ def server_process(server, host_and_port, url):
|
||||
if server_ready(url):
|
||||
yield
|
||||
|
||||
server.terminate()
|
||||
server.kill()
|
||||
server.join()
|
||||
server.close()
|
||||
|
||||
|
||||
def test_server_predict(url):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user