Skip to content

Commit 879ff2c

Browse files
committed
Addressed additional pre-commit findings.
1 parent 2671eec commit 879ff2c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/xdist/scheduler/isoscope.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import enum
4848
from math import ceil
4949
import random
50+
from typing import cast
5051
from typing import TYPE_CHECKING
5152

5253
import pytest
@@ -366,8 +367,8 @@ def add_node_collection(
366367

367368
# Check that the new collection matches the official collection
368369
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),
371372
node=node,
372373
collection=collection,
373374
):
@@ -399,9 +400,9 @@ def add_node_collection(
399400
for pending_worker in workers_with_collection[1:]:
400401
if not self._do_two_nodes_have_same_collection(
401402
reference_node=reference_worker.node,
402-
reference_collection=reference_worker.collection,
403+
reference_collection=cast(tuple[str, ...], reference_worker.collection),
403404
node=pending_worker.node,
404-
collection=pending_worker.collection,
405+
collection=cast(tuple[str, ...],pending_worker.collection),
405406
):
406407
same_collection = False
407408

@@ -427,7 +428,8 @@ def add_node_collection(
427428
# particularly slow)
428429
all_tests = [
429430
_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))
431433
]
432434
shuffled_test_collection = random.sample(all_tests, k=len(all_tests))
433435

@@ -453,7 +455,7 @@ def mark_test_complete(
453455
if self._log.enabled:
454456
self._log(
455457
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]}; "
457459
f"{item_index=}; {worker}"
458460
)
459461

@@ -714,7 +716,7 @@ def _handle_state_fence(self) -> None:
714716
), f"{self._state=} is not {self._State.FENCE}"
715717

716718
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)
718720
)
719721

720722
# The prior state should have ensured that there is at least one worker
@@ -1093,7 +1095,7 @@ def collection(self) -> tuple[str, ...] | None:
10931095
return self._collection
10941096

10951097
@collection.setter
1096-
def collection(self, collection: tuple[str, ...]):
1098+
def collection(self, collection: tuple[str, ...]) -> None:
10971099
"""
10981100
:param collection: An ordered collection of test IDs collected by the
10991101
remote worker. Must not be `None`. Also, MUST NOT be set already.

0 commit comments

Comments
 (0)