Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: translate_span: Make assert more specific #370

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

torarvid
Copy link
Member

Before this commit, the assert in translate_span would now allow for a duration_ms of 0. This usually makes sense, but what the assert seems to actually be for, is to check whether duration_ms has been set (that is, somebody has run .finished() on the Span).

This fixes the assert to check that duration_ms is not None, which has the nice side-effect that it allows for Spans to be created+finished in a unittest setting where freezegun.freeze_time() is activated.

Before this commit, the assert in translate_span would now allow for a
duration_ms of `0`. This usually makes sense, but what the assert seems
to actually be for, is to check whether duration_ms has been set (that
is, somebody has run .finished() on the Span).

This fixes the assert to check that duration_ms is not None, which has
the nice side-effect that it allows for Spans to be created+finished in
a unittest setting where freezegun.freeze_time() is activated.
@torarvid torarvid requested a review from eirsyl March 11, 2025 09:49
@torarvid torarvid requested a review from kiloreven as a code owner March 11, 2025 09:49
@torarvid
Copy link
Member Author

🤢 I thought we had better taste than this...

image

@torarvid torarvid changed the title translate_span: Make assert more specific fix: translate_span: Make assert more specific Mar 11, 2025
@torarvid torarvid merged commit 1145be0 into main Mar 11, 2025
7 of 8 checks passed
@torarvid torarvid deleted the torarvid/support-freezegun branch March 11, 2025 10:00
torarvid pushed a commit that referenced this pull request Mar 11, 2025
🤖 I have created a release *beep* *boop*
---


## [5.2.1](5.2.0...5.2.1)
(2025-03-11)


### Bug Fixes

* translate_span: Make assert more specific
([#370](#370))
([1145be0](1145be0))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant