Skip to content

Commit 691a075

Browse files
authored
Merge pull request #865 from amezin/fix-loadsched-tests
Fix some LoadScheduling tests
2 parents d1dfad3 + e986092 commit 691a075

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

testing/test_dsession.py

+12-14
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def test_schedule_maxchunk_1(self, pytester: pytest.Pytester) -> None:
184184
assert sched.pending == list(range(first_pending, 16))
185185

186186
def test_schedule_fewer_tests_than_nodes(self, pytester: pytest.Pytester) -> None:
187-
config = pytester.parseconfig("--tx=2*popen")
187+
config = pytester.parseconfig("--tx=3*popen")
188188
sched = LoadScheduling(config)
189189
sched.add_node(MockNode())
190190
sched.add_node(MockNode())
@@ -193,20 +193,19 @@ def test_schedule_fewer_tests_than_nodes(self, pytester: pytest.Pytester) -> Non
193193
col = ["xyz"] * 2
194194
sched.add_node_collection(node1, col)
195195
sched.add_node_collection(node2, col)
196+
sched.add_node_collection(node3, col)
197+
assert sched.collection_is_completed
196198
sched.schedule()
197199
# assert not sched.tests_finished
198-
sent1 = node1.sent
199-
sent2 = node2.sent
200-
sent3 = node3.sent
201-
assert sent1 == [0]
202-
assert sent2 == [1]
203-
assert sent3 == []
200+
assert node1.sent == [0]
201+
assert node2.sent == [1]
202+
assert node3.sent == []
204203
assert not sched.pending
205204

206205
def test_schedule_fewer_than_two_tests_per_node(
207206
self, pytester: pytest.Pytester
208207
) -> None:
209-
config = pytester.parseconfig("--tx=2*popen")
208+
config = pytester.parseconfig("--tx=3*popen")
210209
sched = LoadScheduling(config)
211210
sched.add_node(MockNode())
212211
sched.add_node(MockNode())
@@ -215,14 +214,13 @@ def test_schedule_fewer_than_two_tests_per_node(
215214
col = ["xyz"] * 5
216215
sched.add_node_collection(node1, col)
217216
sched.add_node_collection(node2, col)
217+
sched.add_node_collection(node3, col)
218+
assert sched.collection_is_completed
218219
sched.schedule()
219220
# assert not sched.tests_finished
220-
sent1 = node1.sent
221-
sent2 = node2.sent
222-
sent3 = node3.sent
223-
assert sent1 == [0, 3]
224-
assert sent2 == [1, 4]
225-
assert sent3 == [2]
221+
assert node1.sent == [0, 3]
222+
assert node2.sent == [1, 4]
223+
assert node3.sent == [2]
226224
assert not sched.pending
227225

228226
def test_add_remove_node(self, pytester: pytest.Pytester) -> None:

0 commit comments

Comments
 (0)