sentry-python
sentry-python copied to clipboard
Fix flaky test
Version
1.39.2
Steps to Reproduce
Run the common test suite in CI. Chances are the cloud_resource_context test_setup_once test will report a failure.
Expected Result
The test is not flaky.
Actual Result
=================================== FAILURES ===================================
_____________ test_setup_once[-cloud_resource_context7-False-True] _____________
tests/integrations/cloud_resource_context/test_cloud_resource_context.py:410: in test_setup_once
fake_warning.assert_not_called()
/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/unittest/mock.py:874: in assert_not_called
raise AssertionError(msg)
E AssertionError: Expected 'warning' to not have been called. Called 2 times.
E Calls: [call('Can not create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep'),
E call('Can not create a child span for %s. Please start a Sentry transaction before calling this function.', 'time.sleep')].