From c8b70c30b98b80af5f532e9b718d3bc55e37a78b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 6 Dec 2020 13:09:53 +0530 Subject: [PATCH] See if adding a sleep + retry makes test less flaky on CI --- src/calibre/srv/tests/ajax.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/calibre/srv/tests/ajax.py b/src/calibre/srv/tests/ajax.py index ea821a36a7..3487698b5e 100644 --- a/src/calibre/srv/tests/ajax.py +++ b/src/calibre/srv/tests/ajax.py @@ -5,7 +5,7 @@ __license__ = 'GPL v3' __copyright__ = '2015, Kovid Goyal ' -import zlib, json, os +import zlib, json, os, time from io import BytesIO from functools import partial @@ -36,7 +36,11 @@ class ContentTest(LibraryBaseTest): conn = server.connect() request = partial(make_request, conn, prefix='/ajax/book') - r, data = request('/x') + try: + r, data = request('/x') + except ConnectionRefusedError: + time.sleep(2) + r, data = request('/x') self.ae(r.status, NOT_FOUND) r, onedata = request('/1')