found bug in pytest fixture setup causing serve_test to fail (s3 backend fixture function vs s3 backend decorator fixture)
This commit is contained in:
parent
40bc8c2c2c
commit
051cea3ded
@ -92,7 +92,9 @@ def storage(client_name, bucket_name, s3_backend, docker_compose):
|
||||
storage.clear_bucket(bucket_name)
|
||||
|
||||
|
||||
@pytest.fixture(params=["minio", "aws"], scope="session")
|
||||
# NOTE: when this fixture is used, then serve_test fails. When instead a decorator with the same logic is used,
|
||||
# serve_test passes.
|
||||
@pytest.fixture(params=["minio", "aws"])
|
||||
def s3_backend(request):
|
||||
return request.param
|
||||
|
||||
|
||||
@ -30,13 +30,13 @@ from test.utils.input import pair_data_with_queue_message
|
||||
"batched",
|
||||
[
|
||||
False,
|
||||
# True,
|
||||
True,
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"one_to_many",
|
||||
[
|
||||
# False,
|
||||
False,
|
||||
True,
|
||||
],
|
||||
)
|
||||
@ -44,14 +44,14 @@ from test.utils.input import pair_data_with_queue_message
|
||||
"analysis_task",
|
||||
[
|
||||
False,
|
||||
# True,
|
||||
True,
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"n_items",
|
||||
[
|
||||
1,
|
||||
# 3,
|
||||
3,
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize("n_pages", [2])
|
||||
@ -60,8 +60,8 @@ from test.utils.input import pair_data_with_queue_message
|
||||
"item_type",
|
||||
[
|
||||
"string",
|
||||
# "image",
|
||||
# "pdf",
|
||||
"image",
|
||||
"pdf",
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
@ -85,18 +85,17 @@ from test.utils.input import pair_data_with_queue_message
|
||||
"components_type",
|
||||
[
|
||||
"test",
|
||||
# "real",
|
||||
"real",
|
||||
],
|
||||
)
|
||||
@pytest.mark.parametrize(
|
||||
"many_to_n",
|
||||
[
|
||||
False,
|
||||
# True,
|
||||
True,
|
||||
],
|
||||
)
|
||||
def test_serving(server_process, bucket_name, components, targets, data_message_pairs, n_items, many_to_n):
|
||||
input("before")
|
||||
print()
|
||||
|
||||
storage, queue_manager, consumer = components
|
||||
@ -135,8 +134,6 @@ def test_serving(server_process, bucket_name, components, targets, data_message_
|
||||
# TODO: correctness of target should be validated as well, since production was become non-trivial
|
||||
assert sorted(outputs) == sorted(targets)
|
||||
|
||||
input("after")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def data_metadata_packs(input_data_items, metadata):
|
||||
@ -181,10 +178,10 @@ def get_data_uploaded_by_consumer(queue_manager, storage, bucket_name):
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def components(components_type, test_components, bucket_name):
|
||||
# if components_type == "real":
|
||||
# components = real_components
|
||||
if components_type == "test":
|
||||
def components(components_type, real_components, test_components, bucket_name):
|
||||
if components_type == "real":
|
||||
components = real_components
|
||||
elif components_type == "test":
|
||||
components = test_components
|
||||
else:
|
||||
raise ValueError(f"Unknown component type '{components_type}'.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user