File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
opentelemetry-api/tests/context Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -74,3 +74,17 @@ def test_set_current(self):
7474
7575 context .detach (token )
7676 self .assertEqual ("yyy" , context .get_value ("a" ))
77+
78+ class TestInitContext (unittest .TestCase ):
79+ def test_load_runtime_context (self ):
80+ from os import environ
81+ from opentelemetry .environment_variables import OTEL_PYTHON_CONTEXT
82+ from opentelemetry .context .contextvars_context import ContextVarsRuntimeContext
83+
84+ environ [OTEL_PYTHON_CONTEXT ] = "contextvars_context"
85+ ctx = context ._load_runtime_context ()
86+ self .assertIsInstance (ctx , ContextVarsRuntimeContext )
87+
88+ environ .pop (OTEL_PYTHON_CONTEXT )
89+ ctx = context ._load_runtime_context ()
90+ self .assertIsInstance (ctx , ContextVarsRuntimeContext )
You can’t perform that action at this time.
0 commit comments