Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
antonpirker committed Feb 22, 2024
1 parent 3bc0e1b commit 357ae7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion sentry_sdk/hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ def iter_trace_propagation_headers(self, span=None):
from the span representing the request, if available, or the current
span on the scope if not.
"""
return Scope.get_isolation_scope().iter_trace_propagation_headers(
return Scope.get_current_scope().iter_trace_propagation_headers(
span=span,
)

Expand Down
22 changes: 10 additions & 12 deletions tests/integrations/rq/test_rq.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import rq
from fakeredis import FakeStrictRedis

from sentry_sdk import configure_scope, start_transaction
from sentry_sdk import Scope, start_transaction
from sentry_sdk.integrations.rq import RqIntegration
from sentry_sdk.utils import parse_version

Expand Down Expand Up @@ -178,19 +178,17 @@ def test_tracing_disabled(
queue = rq.Queue(connection=FakeStrictRedis())
worker = rq.SimpleWorker([queue], connection=queue.connection)

with configure_scope() as scope:
queue.enqueue(crashing_job, foo=None)
worker.work(burst=True)
scope = Scope.get_isolation_scope()
queue.enqueue(crashing_job, foo=None)
worker.work(burst=True)

(error_event,) = events
(error_event,) = events

assert (
error_event["transaction"] == "tests.integrations.rq.test_rq.crashing_job"
)
assert (
error_event["contexts"]["trace"]["trace_id"]
== scope._propagation_context["trace_id"]
)
assert error_event["transaction"] == "tests.integrations.rq.test_rq.crashing_job"
assert (
error_event["contexts"]["trace"]["trace_id"]
== scope._propagation_context["trace_id"]
)


def test_transaction_no_error(
Expand Down

0 comments on commit 357ae7e

Please sign in to comment.