File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 33import platform
44import tempfile
55import threading
6+ import time
67from http .server import HTTPServer , SimpleHTTPRequestHandler
78from pathlib import Path
89from unittest import mock
@@ -464,4 +465,11 @@ def test_all_workflow_when_server_down(self):
464465 def assert_tracking_count (self , tracking , count : int ):
465466 # Prior to 3.6, `Response` object can't be obtained.
466467 if compare_version ([int (x ) for x in platform .python_version ().split ('.' )], [3 , 7 ]) >= 0 :
467- assert tracking .call_count == count
468+ # Sometimes, `tracking.call_count` is not updated immediately. So, wait a moment until it is updated.
469+ attempt = 0
470+ while tracking .call_count < count :
471+ time .sleep (0.1 )
472+ attempt += 1
473+ if attempt > 10 :
474+ break
475+ self .assertEqual (tracking .call_count , count )
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ def test_reason(self):
5151
5252 # use new session to disable retry
5353 cli = _HttpClient (session = Session ())
54- # /error is an actual endpoint that exists on our service to test the behavior
55- res = cli .request ("GET" , "intake/error " )
54+ # /raise_error is an actual endpoint that exists on our service to test the behavior
55+ res = cli .request ("GET" , "intake/raise_error " )
5656 self .assertEqual (res .status_code , 500 )
5757 self .assertEqual (res .reason , "Welp" )
5858
You can’t perform that action at this time.
0 commit comments