Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

pytest-otel - AttributeError: 'NoneType' object has no attribute 'get_current' #1969

Closed
andrewkroh opened this issue Dec 5, 2022 · 1 comment

Comments

@andrewkroh
Copy link
Member

I was trying to perform a test with Auditbeat running on Ubuntu 22.04, but could not get pytest to run due to an otel related error. From #1687 it looks like we had overcome this error after upgrading opentelemetry-sdk dependencies, but perhaps something about Ubuntu 22.04 is different?

Error

Test run

platform linux -- Python 3.10.6, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
plugins: timeout-1.4.2, otel-1.1.1, rerunfailures-9.1.1

AttributeError: 'NoneType' object has no attribute 'get_current'

../../../../../../python-env/build/ve/linux/lib/python3.10/site-packages/pytest_otel/__init__.py:290: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../../../../python-env/build/ve/linux/lib/python3.10/site-packages/opentelemetry/trace/propagation/__init__.py:34: in set_span_in_context
    ctx = set_value(_SPAN_KEY, span, context=context)
../../../../../../python-env/build/ve/linux/lib/python3.10/site-packages/opentelemetry/context/__init__.py:116: in set_value
    context = get_current()
../../../../../../python-env/build/ve/linux/lib/python3.10/site-packages/opentelemetry/context/__init__.py:67: in wrapper
    return func(*args, **kwargs)  # type: ignore[misc]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

Related things

@andrewkroh andrewkroh changed the title pytest-otel - AttributeError: 'NoneType' object has no attribute 'get_current' pytest-otel - AttributeError: 'NoneType' object has no attribute 'get_current' Dec 5, 2022
@kuisathaverat
Copy link
Contributor

Version 1.1.0 contains the fix for Python 3.10 issue, this version requires pytest 6.2.5, that's the issue in beats repo.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants