From e93eed7c54af2d488ec1d9b945f756f148685182 Mon Sep 17 00:00:00 2001 From: Naoto Ono Date: Tue, 16 Sep 2025 13:26:52 +0900 Subject: [PATCH] Fix CI on the v1 branch --- tests/commands/test_api_error.py | 10 +++++++++- tests/utils/test_http_client.py | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/commands/test_api_error.py b/tests/commands/test_api_error.py index 7c8cd16fd..8a9249a35 100644 --- a/tests/commands/test_api_error.py +++ b/tests/commands/test_api_error.py @@ -3,6 +3,7 @@ import platform import tempfile import threading +import time from http.server import HTTPServer, SimpleHTTPRequestHandler from pathlib import Path from unittest import mock @@ -464,4 +465,11 @@ def test_all_workflow_when_server_down(self): def assert_tracking_count(self, tracking, count: int): # Prior to 3.6, `Response` object can't be obtained. if compare_version([int(x) for x in platform.python_version().split('.')], [3, 7]) >= 0: - assert tracking.call_count == count + # Sometimes, `tracking.call_count` is not updated immediately. So, wait a moment until it is updated. + attempt = 0 + while tracking.call_count < count: + time.sleep(0.1) + attempt += 1 + if attempt > 10: + break + self.assertEqual(tracking.call_count, count) diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py index a565e2286..9fb4f8704 100644 --- a/tests/utils/test_http_client.py +++ b/tests/utils/test_http_client.py @@ -51,8 +51,8 @@ def test_reason(self): # use new session to disable retry cli = _HttpClient(session=Session()) - # /error is an actual endpoint that exists on our service to test the behavior - res = cli.request("GET", "intake/error") + # /raise_error is an actual endpoint that exists on our service to test the behavior + res = cli.request("GET", "intake/raise_error") self.assertEqual(res.status_code, 500) self.assertEqual(res.reason, "Welp")