refactoring: splitting conftest logic into submodules
This commit is contained in:
parent
dbc618aab9
commit
128b325c0d
@ -21,12 +21,13 @@ from image_prediction.label_mapper.mappers.probability import ProbabilityMapper,
|
||||
from image_prediction.locations import TEST_DATA_DIR
|
||||
from image_prediction.pipeline import load_pipeline
|
||||
from image_prediction.utils import get_logger
|
||||
from test.utils.generation.image import array_to_image
|
||||
from test.utils.generation.pdf import add_image, pdf_stream
|
||||
|
||||
pytest_plugins = [
|
||||
'test.fixtures.model',
|
||||
'test.fixtures.model_store',
|
||||
'test.fixtures.image',
|
||||
'test.fixtures.input',
|
||||
]
|
||||
|
||||
|
||||
@ -77,11 +78,6 @@ def expected_predictions(label_format, batch_of_expected_numeric_labels, batch_o
|
||||
raise UnknownLabelFormat(f"No label mapper for label format {label_format} was specified.")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def images(input_batch):
|
||||
return list(map(array_to_image, input_batch))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_batch(batch_size, input_size):
|
||||
return np.random.random_sample(size=(batch_size, *input_size))
|
||||
@ -92,22 +88,6 @@ def batch_size(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_size(alpha, __input_size):
|
||||
w, h, d = __input_size
|
||||
return w, h, d + alpha
|
||||
|
||||
|
||||
@pytest.fixture(params=[False])
|
||||
def alpha(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=[{"width": 10, "height": 15, "depth": 3}, {"width": 150, "height": 100, "depth": 3}])
|
||||
def __input_size(request):
|
||||
return itemgetter("width", "height", "depth")(request.param)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def batch_of_expected_string_labels(batch_of_expected_numeric_labels, classes):
|
||||
return map_labels(batch_of_expected_numeric_labels, classes)
|
||||
@ -263,16 +243,6 @@ def base_patch_metadata(width, height, page_width, page_height):
|
||||
return metadata
|
||||
|
||||
|
||||
@pytest.fixture(params=[33, 100])
|
||||
def height(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=[10, 31])
|
||||
def width(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=[220, 30])
|
||||
def page_height(request):
|
||||
return request.param
|
||||
|
||||
36
test/fixtures/image.py
vendored
36
test/fixtures/image.py
vendored
@ -0,0 +1,36 @@
|
||||
from operator import itemgetter
|
||||
|
||||
import pytest
|
||||
|
||||
from test.utils.generation.image import array_to_image
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def images(input_batch):
|
||||
return list(map(array_to_image, input_batch))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_size(alpha, __input_size):
|
||||
w, h, d = __input_size
|
||||
return w, h, d + alpha
|
||||
|
||||
|
||||
@pytest.fixture(params=[False])
|
||||
def alpha(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=[{"width": 10, "height": 15, "depth": 3}, {"width": 150, "height": 100, "depth": 3}])
|
||||
def __input_size(request):
|
||||
return itemgetter("width", "height", "depth")(request.param)
|
||||
|
||||
|
||||
@pytest.fixture(params=[33, 100])
|
||||
def height(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@pytest.fixture(params=[10, 31])
|
||||
def width(request):
|
||||
return request.param
|
||||
0
test/fixtures/parameters.py
vendored
Normal file
0
test/fixtures/parameters.py
vendored
Normal file
Loading…
x
Reference in New Issue
Block a user