Skip to content

test(logs): Avoid failure when running with integrations enabled #4316

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

Merged

Conversation

rominf
Copy link
Contributor

@rominf rominf commented Apr 17, 2025

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.


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.

@rominf rominf requested a review from a team as a code owner April 17, 2025 17:46
Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.30%. Comparing base (f3687fc) to head (200ca56).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4316   +/-   ##
=======================================
  Coverage   80.30%   80.30%           
=======================================
  Files         142      142           
  Lines       15925    15925           
  Branches     2724     2724           
=======================================
  Hits        12789    12789           
  Misses       2262     2262           
  Partials      874      874           

see 2 files with indirect coverage changes

@rominf rominf changed the title test(logs): avoid failure when running with integrations enabled test(logs): Avoid failure when running with integrations enabled Apr 18, 2025
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.
@rominf rominf force-pushed the rominf-test-logs-sentry.sdk.name branch from 1e87490 to 200ca56 Compare April 18, 2025 05:45
Copy link
Member

@antonpirker antonpirker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for the contribution!

@antonpirker antonpirker merged commit c361337 into getsentry:master Apr 22, 2025
141 checks passed
@rominf rominf deleted the rominf-test-logs-sentry.sdk.name branch April 22, 2025 09:35
rominf added a commit to rominf/sentry-python that referenced this pull request May 14, 2025
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: getsentry#4316
rominf added a commit to rominf/sentry-python that referenced this pull request May 17, 2025
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: getsentry#4316
antonpirker pushed a commit that referenced this pull request May 20, 2025
…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.
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.

2 participants