@@ -255,7 +255,7 @@ def test_no_auto_move_without_email_activity(alice, in_progress_cf, open_cf):
255255 mail = QueuedMail .objects .first ()
256256 body = get_email_body (mail )
257257 assert "Inactive Patch" in body
258- assert "need " in body # "needs attention"
258+ assert "needs attention " in body
259259
260260
261261def test_no_auto_move_when_failing_too_long (alice , in_progress_cf , open_cf ):
@@ -290,6 +290,12 @@ def test_no_auto_move_when_failing_too_long(alice, in_progress_cf, open_cf):
290290 patch .refresh_from_db ()
291291 assert patch .current_commitfest ().id == in_progress_cf .id
292292
293+ # Author should receive closure notification
294+ assert QueuedMail .objects .count () == 1
295+ mail = QueuedMail .objects .first ()
296+ body = get_email_body (mail )
297+ assert "Failing Patch" in body
298+
293299
294300def test_auto_move_when_failing_within_threshold (alice , in_progress_cf , open_cf ):
295301 """Patches failing CI within the threshold should still be auto-moved."""
@@ -327,68 +333,22 @@ def test_auto_move_when_failing_within_threshold(alice, in_progress_cf, open_cf)
327333 assert QueuedMail .objects .count () == 0
328334
329335
330- def test_no_auto_move_with_null_lastmail (alice , in_progress_cf , open_cf ):
331- """Patches with no email activity (null lastmail) should NOT be auto-moved."""
332- patch = Patch .objects .create (
333- name = "No Activity Patch" ,
334- lastmail = None ,
335- )
336- patch .authors .add (alice )
337- PatchOnCommitFest .objects .create (
338- patch = patch ,
339- commitfest = in_progress_cf ,
340- enterdate = datetime .now (),
341- status = PatchOnCommitFest .STATUS_REVIEW ,
342- )
343-
344- in_progress_cf .auto_move_active_patches ()
345-
346- patch .refresh_from_db ()
347- assert patch .current_commitfest ().id == in_progress_cf .id
348-
349-
350- def test_auto_move_patch_without_cfbot_branch (alice , in_progress_cf , open_cf ):
351- """Patches with recent activity but no CI branch should be auto-moved."""
352- patch = Patch .objects .create (
353- name = "No CI Patch" ,
354- lastmail = datetime .now () - timedelta (days = 5 ),
355- )
356- patch .authors .add (alice )
357- PatchOnCommitFest .objects .create (
358- patch = patch ,
359- commitfest = in_progress_cf ,
360- enterdate = datetime .now (),
361- status = PatchOnCommitFest .STATUS_REVIEW ,
362- )
363-
364- # No CfbotBranch created - CI never ran
365-
366- in_progress_cf .auto_move_active_patches ()
367- in_progress_cf .send_closure_notifications ()
368-
369- patch .refresh_from_db ()
370- assert patch .current_commitfest ().id == open_cf .id
371-
372- # No closure email for moved patches
373- assert QueuedMail .objects .count () == 0
374-
375-
376336def test_regular_cf_does_not_move_to_draft_cf (alice , in_progress_cf ):
377337 """Regular commitfest should move patches to the next regular CF, not a draft CF."""
378- # Create a draft CF - should be ignored for regular CF patches
338+ # Create a draft CF with earlier startdate - should be ignored for regular CF patches
379339 draft_cf = CommitFest .objects .create (
380- name = "2025-05 -draft" ,
340+ name = "2024-12 -draft" ,
381341 status = CommitFest .STATUS_OPEN ,
382- startdate = date (2025 , 5 , 1 ),
383- enddate = date (2025 , 5 , 31 ),
342+ startdate = date (2024 , 12 , 1 ),
343+ enddate = date (2024 , 12 , 31 ),
384344 draft = True ,
385345 )
386- # Create a regular CF - this is where patches should go
346+ # Create a regular CF with later startdate - this is where patches should go
387347 regular_cf = CommitFest .objects .create (
388- name = "2025-01 " ,
348+ name = "2025-03 " ,
389349 status = CommitFest .STATUS_OPEN ,
390- startdate = date (2025 , 1 , 1 ),
391- enddate = date (2025 , 1 , 31 ),
350+ startdate = date (2025 , 3 , 1 ),
351+ enddate = date (2025 , 3 , 31 ),
392352 draft = False ,
393353 )
394354
@@ -422,6 +382,14 @@ def test_draft_cf_moves_active_patches_to_next_draft(alice, bob):
422382 enddate = date (2025 , 3 , 31 ),
423383 draft = True ,
424384 )
385+ # Create a regular open CF with earlier startdate - should be ignored for draft patches
386+ CommitFest .objects .create (
387+ name = "2025-05" ,
388+ status = CommitFest .STATUS_OPEN ,
389+ startdate = date (2025 , 5 , 1 ),
390+ enddate = date (2025 , 5 , 31 ),
391+ draft = False ,
392+ )
425393 next_draft_cf = CommitFest .objects .create (
426394 name = "2026-03-draft" ,
427395 status = CommitFest .STATUS_OPEN ,
0 commit comments