File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class EventError(Exception):
13
13
14
14
def __init__ (self , event_id : int , message : Optional [str ]):
15
15
# 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 :
17
17
message = None
18
18
19
19
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(
328
328
assert err .message == "oh no!"
329
329
else :
330
330
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