Skip to content

Commit 83e0386

Browse files
authored
tests(logs): avoid failures when running with integrations enabled (#4388)
When (at least) one of integrations is enabled (because some dependencies are installed in the environment), `sentry.sdk.name` is changed from `sentry.python` to `sentry.python.[FIRST_ENABLED_INTEGRATION]` which makes `test_logs_attributes` fail. Prevent failure by relaxing the check. This change is beneficial not only for packaging (this patch was required for packaging for Fedora), but also for running tests with `pytest` directly. See also: #4316 <!-- Describe your PR here --> --- Thank you for contributing to `sentry-python`! Please add tests to validate your changes, and lint your code using `tox -e linters`. Running the test suite on your PR might require maintainer approval.
1 parent e2e8f92 commit 83e0386

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_logs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ def test_logger_with_all_attributes(sentry_init, capture_envelopes):
447447
assert isinstance(attributes["thread.name"], str)
448448
del attributes["thread.name"]
449449

450+
assert attributes.pop("sentry.sdk.name").startswith("sentry.python")
451+
450452
# Assert on the remaining non-dynamic attributes.
451453
assert attributes == {
452454
"foo": "bar",
@@ -457,7 +459,6 @@ def test_logger_with_all_attributes(sentry_init, capture_envelopes):
457459
"sentry.message.template": "log #%d",
458460
"sentry.message.parameter.0": 1,
459461
"sentry.environment": "production",
460-
"sentry.sdk.name": "sentry.python",
461462
"sentry.sdk.version": VERSION,
462463
"sentry.severity_number": 13,
463464
"sentry.severity_text": "warn",

0 commit comments

Comments
 (0)