fixed bug in stream_pages: return -> yield
This commit is contained in:
parent
5b45f5fa15
commit
7e46a66698
@ -133,7 +133,6 @@ class PikaQueueManager(QueueManager):
|
||||
return self.channel.basic_get(self._input_queue)
|
||||
|
||||
def consume(self, inactivity_timeout=None, n=None):
|
||||
print(f"{n=}")
|
||||
logger.debug("Consuming")
|
||||
gen = self.channel.consume(self._input_queue, inactivity_timeout=inactivity_timeout)
|
||||
yield from islice(gen, n)
|
||||
|
||||
2
test/fixtures/input.py
vendored
2
test/fixtures/input.py
vendored
@ -134,7 +134,7 @@ def images_to_bytes(images):
|
||||
|
||||
@pytest.fixture
|
||||
def metadata(n_items):
|
||||
return list(repeat({"key": "value", "pages": [0, 2, 3]}, n_items))
|
||||
return repeat({"key": "value", "pages": [0, 2, 3]})
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
2
test/fixtures/server.py
vendored
2
test/fixtures/server.py
vendored
@ -65,7 +65,7 @@ def operation(core_operation):
|
||||
result = core_operation(data, metadata)
|
||||
if isinstance(result, Generator):
|
||||
for data, metadata in result:
|
||||
return data, omit(metadata, ["pages", "operation"])
|
||||
yield data, omit(metadata, ["pages", "operation"])
|
||||
else:
|
||||
data, metadata = result
|
||||
return data, omit(metadata, ["pages", "operation"])
|
||||
|
||||
@ -76,8 +76,8 @@ def test_serving(server_process, bucket_name, components, targets, data_message_
|
||||
consumer.consume_and_publish(n=n_items)
|
||||
outputs = get_data_uploaded_by_consumer(queue_manager, storage, bucket_name)
|
||||
|
||||
targets = sorted(targets, key=itemgetter(0))
|
||||
assert outputs == targets
|
||||
# TODO: correctness of target should be validated as well, since production was become non-trivial
|
||||
assert sorted(outputs) == sorted(targets)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user