Skip to content

Commit c717ccc

Browse files
Updates link validity check to be robust against flakiness
1 parent 895f5df commit c717ccc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tripy/tests/test_ux.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,15 @@ def test_links_valid(self, readme):
5454
continue
5555

5656
if link.startswith("https://"):
57-
# Separating the requests.get(link) into a separate step since otherwise the
58-
# pytest backtrace becomes unreadably large.
59-
link_status = requests.get(link).status_code
57+
link_status = None
58+
for _ in range(15): # Try several times since some links are a bit flaky
59+
try:
60+
link_status = requests.get(link).status_code
61+
except:
62+
# Suppress verbose errors
63+
pass
64+
else:
65+
break
6066
assert link_status == 200, f"Broken link: {link}"
6167
else:
6268
assert os.path.sep * 2 not in link, f"Duplicate slashes break links in GitHub. Link was: {link}"

0 commit comments

Comments
 (0)