2424 OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT ,
2525)
2626from opentelemetry .util .genai .types import ContentCapturingMode
27- from opentelemetry .util .genai .utils import get_content_capturing_mode , logger
27+ from opentelemetry .util .genai .utils import get_content_capturing_mode
2828
2929
30- def patch_env_vars (* , stability_mode , content_capturing ):
30+ def patch_env_vars (stability_mode , content_capturing ):
3131 def decorator (test_case ):
3232 @patch .dict (
3333 os .environ ,
@@ -48,29 +48,34 @@ def wrapper(*args, **kwargs):
4848
4949
5050class TestVersion (unittest .TestCase ):
51- @patch_env_vars ("gen_ai_latest_experimental" , "SPAN_ONLY" )
51+ @patch_env_vars (
52+ stability_mode = "gen_ai_latest_experimental" ,
53+ content_capturing = "SPAN_ONLY" ,
54+ )
5255 def test_get_content_capturing_mode_parses_valid_envvar (self ): # pylint: disable=no-self-use
53- _OpenTelemetrySemanticConventionStability ._initialized = False
5456 assert get_content_capturing_mode () == ContentCapturingMode .SPAN_ONLY
5557
56- @patch_env_vars ("gen_ai_latest_experimental" , "" )
58+ @patch_env_vars (
59+ stability_mode = "gen_ai_latest_experimental" , content_capturing = ""
60+ )
5761 def test_empty_content_capturing_envvar (self ): # pylint: disable=no-self-use
58- _OpenTelemetrySemanticConventionStability ._initialized = False
5962 assert get_content_capturing_mode () == ContentCapturingMode .NO_CONTENT
6063
61- @patch_env_vars ("default" , "True" )
64+ @patch_env_vars (stability_mode = "default" , content_capturing = "True" )
6265 def test_get_content_capturing_mode_raises_exception_when_semconv_stability_default (
6366 self ,
6467 ): # pylint: disable=no-self-use
65- _OpenTelemetrySemanticConventionStability ._initialized = False
6668 with self .assertRaises (ValueError ):
6769 get_content_capturing_mode ()
6870
69- @patch_env_vars ("gen_ai_latest_experimental" , "INVALID_VALUE" )
71+ @patch_env_vars (
72+ stability_mode = "gen_ai_latest_experimental" ,
73+ content_capturing = "INVALID_VALUE" ,
74+ )
7075 def test_get_content_capturing_mode_raises_exception_on_invalid_envvar (
7176 self ,
7277 ): # pylint: disable=no-self-use
73- with self .assertLogs (logger , level = "WARNING" ) as cm :
78+ with self .assertLogs (level = "WARNING" ) as cm :
7479 assert (
7580 get_content_capturing_mode () == ContentCapturingMode .NO_CONTENT
7681 )
0 commit comments