File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class EventError(Exception):
1313
1414 def __init__ (self , event_id : int , message : Optional [str ]):
1515 # Edge case, sometimes the message is populated with an empty string
16- if len (message ) < 1 :
16+ if message is not None and len (message ) < 1 :
1717 message = None
1818
1919 self .event_id = event_id
Original file line number Diff line number Diff line change @@ -328,3 +328,17 @@ def test_wait_for_event_finished_failed(
328328 assert err .message == "oh no!"
329329 else :
330330 raise Exception ("Expected event error, got none" )
331+
332+ def test_event_error (
333+ self ,
334+ ):
335+ """
336+ Tests that EventError objects can be constructed and
337+ will be formatted to the correct output.
338+
339+ Tests for regression of TPT-3060
340+ """
341+
342+ assert str (EventError (123 , None )) == "Event 123 failed"
343+ assert str (EventError (123 , "" )) == "Event 123 failed"
344+ assert str (EventError (123 , "foobar" )) == "Event 123 failed: foobar"
You can’t perform that action at this time.
0 commit comments