@@ -113,6 +113,7 @@ def mocked_api_pagination_logic(*_: Any, **kwargs: Any) -> dict:
113113@dataclasses .dataclass
114114class TestCase :
115115 """Class representing a single test case for pagination tests."""
116+
116117 id : str
117118 inputs : dict
118119 expected_items : list [dict [str , int ]]
@@ -154,7 +155,7 @@ def supports(self, client: BaseClient | BaseClientAsync) -> bool:
154155
155156ALL_CLIENTS = COLLECTION_CLIENTS | NO_OPTIONS_CLIENTS | STORAGE_CLIENTS
156157
157- TEST_CASES = {
158+ TEST_CASES = (
158159 TestCase ('No options' , {}, create_items (0 , 2500 ), ALL_CLIENTS ),
159160 TestCase ('Limit' , {'limit' : 1100 }, create_items (0 , 1100 ), ALL_CLIENTS - NO_OPTIONS_CLIENTS ),
160161 TestCase ('Out of range limit' , {'limit' : 3000 }, create_items (0 , 2500 ), ALL_CLIENTS - NO_OPTIONS_CLIENTS ),
@@ -183,7 +184,7 @@ def supports(self, client: BaseClient | BaseClientAsync) -> bool:
183184 ),
184185 TestCase ('Exclusive start key' , {'exclusive_start_key' : 1000 }, create_items (1001 , 2500 ), {'KeyValueStoreClient' }),
185186 TestCase ('Exclusive start id' , {'exclusive_start_id' : 1000 }, create_items (1001 , 2500 ), {'RequestQueueClient' }),
186- }
187+ )
187188
188189
189190def generate_test_params (
@@ -196,11 +197,13 @@ def generate_test_params(
196197
197198 client = ApifyClientAsync (token = '' ) if async_clients else ApifyClient (token = '' )
198199
199- clients : set [BaseClient | BaseClientAsync ]
200+ # This is tuple instead of set because pytest-xdist
201+ # https://pytest-xdist.readthedocs.io/en/stable/known-limitations.html#order-and-amount-of-test-must-be-consistent
202+ clients : tuple [BaseClient | BaseClientAsync , ...]
200203
201204 match client_set :
202205 case 'collection' :
203- clients = {
206+ clients = (
204207 client .actors (),
205208 client .schedules (),
206209 client .tasks (),
@@ -214,13 +217,13 @@ def generate_test_params(
214217 client .actor ('some-id' ).runs (),
215218 client .actor ('some-id' ).versions (),
216219 client .actor ('some-id' ).version ('some-version' ).env_vars (),
217- }
220+ )
218221 case 'kvs' :
219- clients = { client .key_value_store ('some-id' )}
222+ clients = ( client .key_value_store ('some-id' ),)
220223 case 'rq' :
221- clients = { client .request_queue ('some-id' )}
224+ clients = ( client .request_queue ('some-id' ),)
222225 case 'dataset' :
223- clients = { client .dataset ('some-id' )}
226+ clients = ( client .dataset ('some-id' ),)
224227 case _:
225228 raise ValueError (f'Unknown client set: { client_set } ' )
226229
0 commit comments