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(utils): Filter out empty string releases #2591

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def get_default_release():
return release

release = get_git_revision()
if release is not None:
if release:
return release

for var in (
Expand Down
13 changes: 13 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from sentry_sdk.utils import (
Components,
Dsn,
get_default_release,
get_error_message,
get_git_revision,
is_valid_sample_rate,
Expand Down Expand Up @@ -579,3 +580,15 @@ def test_devnull_not_found():
revision = get_git_revision()

assert revision is None


def test_default_release():
release = get_default_release()
assert release is not None


def test_default_release_empty_string():
with mock.patch("sentry_sdk.utils.get_git_revision", return_value=""):
release = get_default_release()

assert release is None
Loading