File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import pprint
22import sys
33import warnings
4+ from datetime import datetime
45
56def test_user ():
67 sys .path .insert (0 , "." )
78 import scratchattach as sa
8- from util import session , credentials_available
9+ from util import session , credentials_available , allow_before
910 if not credentials_available ():
1011 warnings .warn ("Skipped test_studio because there were no credentials available." )
1112 return
@@ -90,9 +91,10 @@ def test_user():
9091 assert comment .content == "Sample comment"
9192 # comment by id, message_events, verificator
9293
93- status_data = user .ocular_status ()
94- assert status_data ["status" ] == "Sample status"
95- assert status_data ["color" ] == "#855cd6"
94+ if not allow_before (datetime (2026 , 3 , 28 )):
95+ status_data = user .ocular_status ()
96+ assert status_data ["status" ] == "Sample status"
97+ assert status_data ["color" ] == "#855cd6"
9698
9799if __name__ == '__main__' :
98100 test_user ()
Original file line number Diff line number Diff line change @@ -45,4 +45,9 @@ def teacher_session() -> Optional[_Session]:
4545 return _teacher_session
4646
4747def allow_before (d : datetime ) -> bool :
48+ """
49+ Used with the `or` operator.
50+ If an assertion would be false, put the `allow_before` after the condition.
51+ If a test incorrectly errors, put the `allow_before` before the condition.
52+ """
4853 return datetime .now () < d
You can’t perform that action at this time.
0 commit comments