@@ -144,7 +144,7 @@ def __init__(self, config: pytest.Config, log: xdist.remote.Producer):
144
144
# is performed once the number of registered node collections reaches
145
145
# `_expected_num_workers`. It is initialized to None and then updated
146
146
# after validation succeeds.
147
- self ._official_test_collection : Tuple [str , ...] | None = None
147
+ self ._official_test_collection : tuple [str , ...] | None = None
148
148
# Remote worker node having `_official_test_collection` as its test
149
149
# collection (for reporting failed collection validations)
150
150
self ._official_test_collection_node : WorkerController | None = None
@@ -184,7 +184,7 @@ def __init__(self, config: pytest.Config, log: xdist.remote.Producer):
184
184
)
185
185
186
186
@property
187
- def nodes (self ) -> List [WorkerController ]:
187
+ def nodes (self ) -> list [WorkerController ]:
188
188
"""A new list of all active `WorkerController` nodes.
189
189
190
190
Called by xdist `DSession`.
@@ -536,7 +536,7 @@ def _reschedule_workers(self) -> None:
536
536
"""Distribute work to workers if needed at this time."""
537
537
assert self ._state is not None
538
538
539
- traversed_states : List [IsoScopeScheduling ._State ] = []
539
+ traversed_states : list [IsoScopeScheduling ._State ] = []
540
540
previous_state = None
541
541
while self ._state != previous_state :
542
542
# NOTE: This loop will terminate because completion of tests and
@@ -764,7 +764,7 @@ def _handle_state_fence(self) -> None:
764
764
self ._log (f"Transitioned from { previous_state !s} to " f"{ self ._state !s} " )
765
765
766
766
def _distribute_workset (
767
- self , workset : _ScopeWorkset , workers : List [_WorkerProxy ]
767
+ self , workset : _ScopeWorkset , workers : list [_WorkerProxy ]
768
768
) -> None :
769
769
"""Distribute the tests in the given workset to the given workers.
770
770
@@ -979,7 +979,7 @@ def _get_max_workers_for_num_tests(num_tests: int) -> int:
979
979
980
980
def _get_workers_available_for_distribution (
981
981
self , scope_id : str
982
- ) -> List [_WorkerProxy ]:
982
+ ) -> list [_WorkerProxy ]:
983
983
"""Return workers available for distribution of the given Scope.
984
984
985
985
Available workers are non-shutting-down workers that either
@@ -1003,7 +1003,7 @@ def _get_workers_available_for_distribution(
1003
1003
)
1004
1004
]
1005
1005
1006
- def _get_workers_ready_for_fencing (self , scope_id : str ) -> List [_WorkerProxy ]:
1006
+ def _get_workers_ready_for_fencing (self , scope_id : str ) -> list [_WorkerProxy ]:
1007
1007
"""Return workers that are ready to be Fenced for the given test Scope.
1008
1008
1009
1009
A worker that needs to be Fenced satisfies all the following conditions:
@@ -1028,9 +1028,9 @@ def _get_workers_ready_for_fencing(self, scope_id: str) -> List[_WorkerProxy]:
1028
1028
def _do_two_nodes_have_same_collection (
1029
1029
self ,
1030
1030
reference_node : WorkerController ,
1031
- reference_collection : Tuple [str , ...],
1031
+ reference_collection : tuple [str , ...],
1032
1032
node : WorkerController ,
1033
- collection : Tuple [str , ...],
1033
+ collection : tuple [str , ...],
1034
1034
) -> bool :
1035
1035
"""
1036
1036
If collections differ, this method returns False while logging
@@ -1081,7 +1081,7 @@ def __init__(self, node: WorkerController):
1081
1081
1082
1082
# An ordered collection of test IDs collected by the remote worker.
1083
1083
# Initially None, until assigned by the Scheduler
1084
- self ._collection : Tuple [str , ...] | None = None
1084
+ self ._collection : tuple [str , ...] | None = None
1085
1085
1086
1086
self ._pending_test_by_index : OrderedDict [int , _TestProxy ] = OrderedDict ()
1087
1087
@@ -1094,15 +1094,15 @@ def node(self) -> WorkerController:
1094
1094
return self ._node
1095
1095
1096
1096
@property
1097
- def collection (self ) -> Tuple [str , ...] | None :
1097
+ def collection (self ) -> tuple [str , ...] | None :
1098
1098
"""
1099
1099
:return: An ordered collection of test IDs collected by the remote
1100
1100
worker; `None` if the collection is not available yet.
1101
1101
"""
1102
1102
return self ._collection
1103
1103
1104
1104
@collection .setter
1105
- def collection (self , collection : Tuple [str , ...]) -> None :
1105
+ def collection (self , collection : tuple [str , ...]) -> None :
1106
1106
"""
1107
1107
:param collection: An ordered collection of test IDs collected by the
1108
1108
remote worker. Must not be `None`. Also, MUST NOT be set already.
@@ -1211,7 +1211,7 @@ def handle_test_completion(self, test_index: int) -> None:
1211
1211
# Remove the test from the worker's pending queue
1212
1212
self ._pending_test_by_index .pop (test_index )
1213
1213
1214
- def release_pending_tests (self ) -> List [_TestProxy ]:
1214
+ def release_pending_tests (self ) -> list [_TestProxy ]:
1215
1215
"""Reset the worker's pending tests, returning those pending tests.
1216
1216
1217
1217
:return: A (possibly empty) list of pending tests.
@@ -1316,7 +1316,7 @@ def enqueue_test(self, test: _TestProxy) -> None:
1316
1316
# Update high watermark
1317
1317
self ._high_water = max (self ._high_water , len (self ._test_by_index ))
1318
1318
1319
- def dequeue_tests (self , num_tests : int ) -> List [_TestProxy ]:
1319
+ def dequeue_tests (self , num_tests : int ) -> list [_TestProxy ]:
1320
1320
"""
1321
1321
Remove and return the given number of tests from the head of the
1322
1322
collection.
0 commit comments