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)
|
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):
|
def s3_backend(request):
|
||||||
return request.param
|
return request.param
|
||||||
|
|
||||||
|
|||||||
@ -30,13 +30,13 @@ from test.utils.input import pair_data_with_queue_message
|
|||||||
"batched",
|
"batched",
|
||||||
[
|
[
|
||||||
False,
|
False,
|
||||||
# True,
|
True,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"one_to_many",
|
"one_to_many",
|
||||||
[
|
[
|
||||||
# False,
|
False,
|
||||||
True,
|
True,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@ -44,14 +44,14 @@ from test.utils.input import pair_data_with_queue_message
|
|||||||
"analysis_task",
|
"analysis_task",
|
||||||
[
|
[
|
||||||
False,
|
False,
|
||||||
# True,
|
True,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"n_items",
|
"n_items",
|
||||||
[
|
[
|
||||||
1,
|
1,
|
||||||
# 3,
|
3,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize("n_pages", [2])
|
@pytest.mark.parametrize("n_pages", [2])
|
||||||
@ -60,8 +60,8 @@ from test.utils.input import pair_data_with_queue_message
|
|||||||
"item_type",
|
"item_type",
|
||||||
[
|
[
|
||||||
"string",
|
"string",
|
||||||
# "image",
|
"image",
|
||||||
# "pdf",
|
"pdf",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -85,18 +85,17 @@ from test.utils.input import pair_data_with_queue_message
|
|||||||
"components_type",
|
"components_type",
|
||||||
[
|
[
|
||||||
"test",
|
"test",
|
||||||
# "real",
|
"real",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"many_to_n",
|
"many_to_n",
|
||||||
[
|
[
|
||||||
False,
|
False,
|
||||||
# True,
|
True,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_serving(server_process, bucket_name, components, targets, data_message_pairs, n_items, many_to_n):
|
def test_serving(server_process, bucket_name, components, targets, data_message_pairs, n_items, many_to_n):
|
||||||
input("before")
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
storage, queue_manager, consumer = components
|
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
|
# TODO: correctness of target should be validated as well, since production was become non-trivial
|
||||||
assert sorted(outputs) == sorted(targets)
|
assert sorted(outputs) == sorted(targets)
|
||||||
|
|
||||||
input("after")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def data_metadata_packs(input_data_items, metadata):
|
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
|
@pytest.fixture
|
||||||
def components(components_type, test_components, bucket_name):
|
def components(components_type, real_components, test_components, bucket_name):
|
||||||
# if components_type == "real":
|
if components_type == "real":
|
||||||
# components = real_components
|
components = real_components
|
||||||
if components_type == "test":
|
elif components_type == "test":
|
||||||
components = test_components
|
components = test_components
|
||||||
else:
|
else:
|
||||||
raise ValueError(f"Unknown component type '{components_type}'.")
|
raise ValueError(f"Unknown component type '{components_type}'.")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user