File: test_propagation.py

package info (click to toggle)
sentry-python 2.18.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,004 kB
  • sloc: python: 55,908; makefile: 114; sh: 111; xml: 2
file content (40 lines) | stat: -rw-r--r-- 1,283 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sentry_sdk
import pytest


def test_standalone_span_iter_headers(sentry_init):
    sentry_init(enable_tracing=True)

    with sentry_sdk.start_span(op="test") as span:
        with pytest.raises(StopIteration):
            # We should not have any propagation headers
            next(span.iter_headers())


def test_span_in_span_iter_headers(sentry_init):
    sentry_init(enable_tracing=True)

    with sentry_sdk.start_span(op="test"):
        with sentry_sdk.start_span(op="test2") as span_inner:
            with pytest.raises(StopIteration):
                # We should not have any propagation headers
                next(span_inner.iter_headers())


def test_span_in_transaction(sentry_init):
    sentry_init(enable_tracing=True)

    with sentry_sdk.start_transaction(op="test"):
        with sentry_sdk.start_span(op="test2") as span:
            # Ensure the headers are there
            next(span.iter_headers())


def test_span_in_span_in_transaction(sentry_init):
    sentry_init(enable_tracing=True)

    with sentry_sdk.start_transaction(op="test"):
        with sentry_sdk.start_span(op="test2"):
            with sentry_sdk.start_span(op="test3") as span_inner:
                # Ensure the headers are there
                next(span_inner.iter_headers())