sadpandajoe commented on code in PR #40693:
URL: https://github.com/apache/superset/pull/40693#discussion_r3345713507


##########
tests/unit_tests/reports/notifications/email_tests.py:
##########
@@ -130,8 +125,12 @@ def test_email_subject_with_datetime() -> None:
             "execution_id": "test-execution-id",
         },
     )
-    subject = EmailNotification(
+    notification = EmailNotification(
         recipient=ReportRecipients(type=ReportRecipientType.EMAIL), 
content=content
-    )._get_subject()
+    )
+    subject = notification._get_subject()
     assert datetime_pattern not in subject
-    assert now.strftime(datetime_pattern) in subject
+    # Compare against the notification's own stamped timestamp rather than a
+    # separately-sampled clock, so the assertion can't flake when the test runs
+    # across the UTC midnight boundary.
+    assert notification.now.strftime(datetime_pattern) in subject

Review Comment:
   Both sides of this assertion read notification.now, so if someone reverted 
this fix, this test would still pass. We should update the test or add one such 
that any revert to your fix would fail the test.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to