Potential fix for flaky celery test (#629)

It seems the same in memory span exporter was being reused by multiple
tests. This change _should_ create a new instance of memeory exporter
per test/function.

Fixes #2067
This commit is contained in:
Owais Lone
2021-08-26 03:30:26 +05:30
committed by GitHub
parent bfaabbf7e1
commit c6976fc51f

View File

@ -70,7 +70,7 @@ def instrument(tracer_provider, memory_exporter):
CeleryInstrumentor().uninstrument()
@pytest.fixture(scope="session")
@pytest.fixture(scope="function")
def tracer_provider(memory_exporter):
original_tracer_provider = trace_api.get_tracer_provider()
@ -86,7 +86,7 @@ def tracer_provider(memory_exporter):
trace_api.set_tracer_provider(original_tracer_provider)
@pytest.fixture(scope="session")
@pytest.fixture(scope="function")
def memory_exporter():
memory_exporter = InMemorySpanExporter()
return memory_exporter