@@ -482,22 +482,22 @@ def test_add_node_and_collection(self, pytester: pytest.Pytester) -> None:
482482 config = pytester .parseconfig ("--tx=2*popen" )
483483 sched = SingleCollectScheduling (config )
484484 node1 , node2 = MockNode (), MockNode ()
485-
485+
486486 # First node should be set as collector
487487 sched .add_node (node1 )
488488 assert sched .first_node == node1
489-
489+
490490 # Second node should not become the collector
491491 sched .add_node (node2 )
492492 assert sched .first_node == node1
493-
493+
494494 # Collection from first node should be used
495495 collection = ["a.py::test_1" , "a.py::test_2" , "a.py::test_3" ]
496496 sched .add_node_collection (node1 , collection )
497497 assert sched .collection == collection
498498 assert sched .collection_done
499499 assert sched .collection_is_completed
500-
500+
501501 # Collection from second node should be ignored
502502 different_collection = ["a.py::test_1" , "a.py::test_4" ]
503503 sched .add_node_collection (node2 , different_collection )
@@ -510,21 +510,21 @@ def test_schedule_tests(self, pytester: pytest.Pytester) -> None:
510510 node1 , node2 = MockNode (), MockNode ()
511511 sched .add_node (node1 )
512512 sched .add_node (node2 )
513-
513+
514514 collection = ["a.py::test_1" , "a.py::test_2" , "a.py::test_3" , "a.py::test_4" ]
515515 sched .add_node_collection (node1 , collection )
516-
516+
517517 # Should use collection from node1 and distribute tests
518518 sched .schedule ()
519-
519+
520520 # Check that tests were distributed across both nodes
521521 assert len (node1 .sent ) > 0
522522 assert len (node2 .sent ) > 0
523-
523+
524524 # Tests should be distributed completely
525525 all_tests = node1 .sent + node2 .sent
526526 assert sorted (all_tests ) == list (range (len (collection )))
527-
527+
528528 # The pending list should be empty after distribution
529529 assert not sched .pending
530530
@@ -534,37 +534,37 @@ def test_handle_node_failure(self, pytester: pytest.Pytester) -> None:
534534 node1 , node2 = MockNode (), MockNode ()
535535 sched .add_node (node1 )
536536 sched .add_node (node2 )
537-
537+
538538 collection = ["a.py::test_1" , "a.py::test_2" , "a.py::test_3" , "a.py::test_4" ]
539539 sched .add_node_collection (node1 , collection )
540540 sched .schedule ()
541-
541+
542542 # Simulate node1 completing a test
543543 test_idx = node1 .sent [0 ]
544544 sched .mark_test_complete (node1 , test_idx )
545-
545+
546546 # Now remove node2 (simulating failure)
547547 crashitem = sched .remove_node (node2 )
548-
548+
549549 # Tests assigned to node2 should go back to pending
550550 assert len (sched .pending ) > 0
551-
551+
552552 # Add a new node
553553 node3 = MockNode ()
554554 sched .add_node (node3 )
555-
555+
556556 # Since collection is already completed, schedule should assign pending tests to node3
557557 sched .schedule ()
558558 assert len (node3 .sent ) > 0
559-
559+
560560 # Complete all tests
561561 for idx in node1 .sent :
562562 if idx != test_idx : # Skip the one we already completed
563563 sched .mark_test_complete (node1 , idx )
564-
564+
565565 for idx in node3 .sent :
566566 sched .mark_test_complete (node3 , idx )
567-
567+
568568 # All tests should be completed
569569 assert sched .tests_finished
570570
@@ -573,25 +573,25 @@ def test_first_node_failure(self, pytester: pytest.Pytester) -> None:
573573 config = pytester .parseconfig ("--tx=2*popen" )
574574 sched = SingleCollectScheduling (config )
575575 node1 , node2 = MockNode (), MockNode ()
576-
576+
577577 # First node should be collector
578578 sched .add_node (node1 )
579579 assert sched .first_node == node1
580-
580+
581581 # Add second node
582582 sched .add_node (node2 )
583-
583+
584584 # First node fails before collection
585585 sched .remove_node (node1 )
586-
586+
587587 # Now second node should become the collector
588588 assert sched .first_node is None # first_node is reset after removal
589-
589+
590590 # Add a new node, it should become the collector
591591 node3 = MockNode ()
592592 sched .add_node (node3 )
593593 assert sched .first_node == node3
594-
594+
595595 # Complete collection with node3
596596 collection = ["a.py::test_1" , "a.py::test_2" ]
597597 sched .add_node_collection (node3 , collection )
0 commit comments