getsentry / sentry-python

The official Python SDK for Sentry.io
https://sentry.io/for/python/
MIT License
1.85k stars 478 forks source link

test failures in test_metrics with Python 3.12 #2637

Closed doko42 closed 3 weeks ago

doko42 commented 7 months ago

How do you use Sentry?

Self-hosted/on-premise

Version

1.39.2

Steps to Reproduce

trying to build the 1.39.2 for Ubuntu, I see two test failures when testing with 3.12.1, but not with 3.11.7:

_ test_timing __ tests/test_metrics.py:112: in test_timing (envelope,) = envelopes E ValueError: too many values to unpack (expected 1) ____ test_timingdecorator ____ tests/test_metrics.py:180: in test_timing_decorator (envelope,) = envelopes E ValueError: too many values to unpack (expected 1) FAILED tests/test_metrics.py::test_timing - ValueError: too many values to un... FAILED tests/test_metrics.py::test_timing_decorator - ValueError: too many va...

together with the hint:

You need to install a suitable plugin for your async framework, for example:

doing that, installing pytest-asyncio, I have a local build passing both tests, however trying that on the buildds, only one of these is gone, the other still failing:

_ test_timing __ tests/test_metrics.py:112: in test_timing (envelope,) = envelopes E ValueError: too many values to unpack (expected 1)

looks like the test case is dependent if an async framework is installed or which async framework is installed. In all cases, the tests pass with 3.11.7.

complete build log at https://launchpadlibrarian.net/709244852/buildlog_ubuntu-noble-amd64.sentry-python_1.39.2-0ubuntu2_BUILDING.txt.gz

Expected Result

the tests should pass with any framework or without framework

Actual Result

see above

doko42 commented 7 months ago

hmm, after three more retries, the test passed now ...

sentrivana commented 7 months ago

Hey @doko42, thanks for reporting. We've already identified and fixed some flaky metrics tests recently but apparently not all -- we'll take a look.

szokeasaurusrex commented 3 weeks ago

@doko42 We think this issue is probably fixed by now, since we have not noticed these tests failing for awhile. Please reopen if you are still blocked by this.