Skip to content

Commit

Permalink
Add tracing for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rebkwok committed Mar 19, 2024
1 parent 1999fb1 commit 2795f42
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
import pytest
import responses as _responses
from django.conf import settings
from opentelemetry.sdk.trace.export import SimpleSpanProcessor
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter

import airlock.business_logic
import tests.factories
import tracing


# set up tracing for tests
test_exporter = InMemorySpanExporter()
tracing.add_exporter(tracing.get_provider(), test_exporter, SimpleSpanProcessor)


def get_trace():
"""Return all spans traced during this test."""
return test_exporter.get_finished_spans() # pragma: no cover


@pytest.fixture(autouse=True)
def clear_all_traces():
test_exporter.clear()


# Fail the test run if we see any warnings
Expand Down

0 comments on commit 2795f42

Please sign in to comment.