Skip to content

Commit 9e6bb90

Browse files
committed
Make tests work in CI
1 parent ebdf822 commit 9e6bb90

File tree

2 files changed

+13
-29
lines changed

2 files changed

+13
-29
lines changed

tests/integration/test_client_pagination.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/unit/test_client_pagination.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def supports(self, client: BaseClient | BaseClientAsync) -> bool:
154154

155155
ALL_CLIENTS = COLLECTION_CLIENTS | NO_OPTIONS_CLIENTS | STORAGE_CLIENTS
156156

157-
TEST_CASES = {
157+
TEST_CASES = (
158158
TestCase('No options', {}, create_items(0, 2500), ALL_CLIENTS),
159159
TestCase('Limit', {'limit': 1100}, create_items(0, 1100), ALL_CLIENTS - NO_OPTIONS_CLIENTS),
160160
TestCase('Out of range limit', {'limit': 3000}, create_items(0, 2500), ALL_CLIENTS - NO_OPTIONS_CLIENTS),
@@ -183,7 +183,7 @@ def supports(self, client: BaseClient | BaseClientAsync) -> bool:
183183
),
184184
TestCase('Exclusive start key', {'exclusive_start_key': 1000}, create_items(1001, 2500), {'KeyValueStoreClient'}),
185185
TestCase('Exclusive start id', {'exclusive_start_id': 1000}, create_items(1001, 2500), {'RequestQueueClient'}),
186-
}
186+
)
187187

188188

189189
def generate_test_params(
@@ -196,11 +196,13 @@ def generate_test_params(
196196

197197
client = ApifyClientAsync(token='') if async_clients else ApifyClient(token='')
198198

199-
clients: set[BaseClient | BaseClientAsync]
199+
# This is tuple instead of set because pytest-xdist
200+
# https://pytest-xdist.readthedocs.io/en/stable/known-limitations.html#order-and-amount-of-test-must-be-consistent
201+
clients: tuple[BaseClient | BaseClientAsync,...]
200202

201203
match client_set:
202204
case 'collection':
203-
clients = {
205+
clients = (
204206
client.actors(),
205207
client.schedules(),
206208
client.tasks(),
@@ -214,13 +216,13 @@ def generate_test_params(
214216
client.actor('some-id').runs(),
215217
client.actor('some-id').versions(),
216218
client.actor('some-id').version('some-version').env_vars(),
217-
}
219+
)
218220
case 'kvs':
219-
clients = {client.key_value_store('some-id')}
221+
clients = (client.key_value_store('some-id'),)
220222
case 'rq':
221-
clients = {client.request_queue('some-id')}
223+
clients = (client.request_queue('some-id'),)
222224
case 'dataset':
223-
clients = {client.dataset('some-id')}
225+
clients = (client.dataset('some-id'),)
224226
case _:
225227
raise ValueError(f'Unknown client set: {client_set}')
226228

@@ -234,6 +236,9 @@ def generate_test_params(
234236
]
235237

236238

239+
a= generate_test_params(client_set='collection', async_clients=True)
240+
print(a)
241+
237242
@pytest.mark.parametrize(
238243
('inputs', 'expected_items', 'client'), generate_test_params(client_set='collection', async_clients=True)
239244
)

0 commit comments

Comments
 (0)