Skip to content

Commit 57de907

Browse files
committed
Hook for ignoring transient request failures for tests requiring network
1 parent c4367ef commit 57de907

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

tests/conftest.py

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010

1111
import pytest
12+
import requests
1213

1314
import blosc2
1415

@@ -36,15 +37,11 @@ def cat2_context():
3637
yield c2params
3738

3839

39-
# This is to avoid sporadic failures in the CI when reaching network,
40-
# but this makes the tests to stuck in local. Perhaps move this to
41-
# every test module that needs it?
42-
# def pytest_runtest_call(item):
43-
# try:
44-
# item.runtest()
45-
# except requests.ConnectTimeout:
46-
# pytest.skip("Skipping test due to sporadic requests.ConnectTimeout")
47-
# except requests.ReadTimeout:
48-
# pytest.skip("Skipping test due to sporadic requests.ReadTimeout")
49-
# except requests.Timeout:
50-
# pytest.skip("Skipping test due to sporadic requests.Timeout")
40+
def pytest_runtest_call(item):
41+
# Skip network-marked tests on transient request failures to keep CI stable.
42+
if item.get_closest_marker("network") is None:
43+
return
44+
try:
45+
item.runtest()
46+
except requests.exceptions.RequestException as exc:
47+
pytest.skip(f"Skipping network test due to request failure: {exc}")

0 commit comments

Comments
 (0)