elastic / elastic/apm-agent-python
Flaky test on windows / python 3.9
- Dominant language
- Python
- Stars
- 431
- Forks
- 239
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 7
Description
```
________ test_send_remote_failover_sync_non_transport_exception_error _________
should_try =
caplog = <_pytest.logging.LogCaptureFixture object at 0x0000019D45CCBE80>
@mock.patch("elasticapm.transport.base.TransportState.should_try", return_value=True)
def test_send_remote_failover_sync_non_transport_exception_error(should_try, caplog):
client = Client(
server_url="http://example.com/",
service_name="app_name",
secret_token="secret",
transport_class="tests.fixtures.MockSendHTTPTransport",
metrics_interval="0ms",
metrics_sets=[],
)
# test error
client._transport.send_mock.side_effect = ValueError("oopsie")
with caplog.at_level("ERROR", "elasticapm.transport"):
client.capture_message("foo", handled=False)
try:
client._transport.flush()
except ValueError:
# give flush a bit more room because we may take a bit more than the max timeout to flush
client._transport._flushed.wait(timeout=1)
> assert client._transport.state.did_fail()
E assert False
E + where False = >()
E + where > = .did_fail
E + where = .state
E + where = ._transport
tests\client\client_tests.py:297: AssertionError
---------------------------- Captured stderr call -----------------------------
{"@timestamp":"2025-12-16T02:38:16.408Z","log.level":"warning","message":"Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError(\"HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)\")': /","ecs.version":"1.6.0","log":{"logger":"urllib3.connectionpool","origin":{"file":{"line":868,"name":"connectionpool.py"},"function":"urlopen"},"original":"Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError(\"HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)\")': /"},"process":{"name":"MainProcess","pid":3960,"thread":{"id":6368,"name":"eapm event processor thread"}},"service":{"name":"app_name"}}
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='example.com', port=80): Read timed out. (read timeout=5)")': /
```
Contributor guide
Assessment
This issue has not been assessed yet.