47
47
import enum
48
48
from math import ceil
49
49
import random
50
+ from typing import cast
50
51
from typing import TYPE_CHECKING
51
52
52
53
import pytest
@@ -366,8 +367,8 @@ def add_node_collection(
366
367
367
368
# Check that the new collection matches the official collection
368
369
if self ._do_two_nodes_have_same_collection (
369
- reference_node = self ._official_test_collection_node , # type: ignore[arg-type]
370
- reference_collection = self ._official_test_collection ,
370
+ reference_node = cast ( WorkerController , self ._official_test_collection_node ),
371
+ reference_collection = cast ( tuple [ str , ...], self ._official_test_collection ) ,
371
372
node = node ,
372
373
collection = collection ,
373
374
):
@@ -399,9 +400,9 @@ def add_node_collection(
399
400
for pending_worker in workers_with_collection [1 :]:
400
401
if not self ._do_two_nodes_have_same_collection (
401
402
reference_node = reference_worker .node ,
402
- reference_collection = reference_worker .collection ,
403
+ reference_collection = cast ( tuple [ str , ...], reference_worker .collection ) ,
403
404
node = pending_worker .node ,
404
- collection = pending_worker .collection ,
405
+ collection = cast ( tuple [ str , ...], pending_worker .collection ) ,
405
406
):
406
407
same_collection = False
407
408
@@ -427,7 +428,8 @@ def add_node_collection(
427
428
# particularly slow)
428
429
all_tests = [
429
430
_TestProxy (test_id = test_id , test_index = test_index )
430
- for test_index , test_id in enumerate (self ._official_test_collection )
431
+ for test_index , test_id in enumerate (
432
+ cast (tuple [str , ...], self ._official_test_collection ))
431
433
]
432
434
shuffled_test_collection = random .sample (all_tests , k = len (all_tests ))
433
435
@@ -453,7 +455,7 @@ def mark_test_complete(
453
455
if self ._log .enabled :
454
456
self ._log (
455
457
f"Marking test complete: "
456
- f"test_id={ self ._official_test_collection [item_index ]} ; "
458
+ f"test_id={ cast ( tuple [ str , ...], self ._official_test_collection ) [item_index ]} ; "
457
459
f"{ item_index = } ; { worker } "
458
460
)
459
461
@@ -714,7 +716,7 @@ def _handle_state_fence(self) -> None:
714
716
), f"{ self ._state = } is not { self ._State .FENCE } "
715
717
716
718
workers_to_fence = self ._get_workers_ready_for_fencing (
717
- scope_id = self ._active_scope_id
719
+ scope_id = cast ( str , self ._active_scope_id )
718
720
)
719
721
720
722
# The prior state should have ensured that there is at least one worker
@@ -1093,7 +1095,7 @@ def collection(self) -> tuple[str, ...] | None:
1093
1095
return self ._collection
1094
1096
1095
1097
@collection .setter
1096
- def collection (self , collection : tuple [str , ...]):
1098
+ def collection (self , collection : tuple [str , ...]) -> None :
1097
1099
"""
1098
1100
:param collection: An ordered collection of test IDs collected by the
1099
1101
remote worker. Must not be `None`. Also, MUST NOT be set already.
0 commit comments