This commit is contained in:
Matthias Bisping 2022-05-16 11:43:48 +02:00
parent 2070f300c9
commit 948575d199
4 changed files with 10 additions and 10 deletions

View File

@ -7,6 +7,6 @@ from pyinfra.server.utils import unpack
@pytest.mark.parametrize("batched", [True, False])
@pytest.mark.parametrize("item_type", ["string", "image", "pdf"])
def test_pickup_endpoint(url, input_data_items, metadata, operation, target_data_items, server_process):
def test_pickup_endpoint(url, input_data_items, metadata, operation, targets, server_process):
output = lmap(unpack, process_lazily(f"{url}/submit", input_data_items, metadata))
assert output == target_data_items
assert output == targets

View File

@ -31,7 +31,7 @@ def input_data_items(item_type, n_items, pdf):
@pytest.fixture
def target_data_items(input_data_items, item_type, operation, metadata):
def targets(input_data_items, item_type, operation, metadata):
op = compose(lift(star(pack)), normalize_item, operation)
expected = lmap(unpack, flatten(starmap(op, zip(input_data_items, metadata))))
return expected

View File

@ -37,14 +37,14 @@ def url(host, port):
@pytest.fixture
def server(processor_fn, buffer_size):
flat_stream_buffer = FlatStreamBuffer(processor_fn, buffer_size=buffer_size)
def server(server_stream_function, buffer_size):
flat_stream_buffer = FlatStreamBuffer(server_stream_function, buffer_size=buffer_size)
queued_stream_function = QueuedStreamFunction(flat_stream_buffer)
return set_up_processing_server(queued_stream_function)
@pytest.fixture
def processor_fn(operation_conditionally_batched, batched):
def server_stream_function(operation_conditionally_batched, batched):
return make_streamable_and_wrap_in_packing_logic(operation_conditionally_batched, batched)

View File

@ -31,10 +31,10 @@ def test_mock_pipeline():
# "basic",
],
)
def test_pipeline(client_pipeline, input_data_items, metadata, target_data_items):
def test_pipeline(client_pipeline, input_data_items, metadata, targets):
output = client_pipeline(input_data_items, metadata)
output = lmap(unpack, output)
assert output == target_data_items
assert output == targets
# @pytest.mark.parametrize("item_type", ["string"])
@ -74,8 +74,8 @@ def rest_client_pipeline(server_process, endpoint, rest_interpreter):
@pytest.fixture
def basic_client_pipeline(endpoint, rest_interpreter, processor_fn):
return ClientPipeline(RestPacker(), ForwardingDispatcher(processor_fn), IdentityReceiver(), IdentityInterpreter())
def basic_client_pipeline(endpoint, rest_interpreter, server_stream_function):
return ClientPipeline(RestPacker(), ForwardingDispatcher(server_stream_function), IdentityReceiver(), IdentityInterpreter())
@pytest.fixture