docstr: Show that redacting password works in context exceptions.
docstr_tok: ["Show","that","redacting","password","works","in","context","exceptions","."]
code: def test_masking_in_explicit_context_exceptions(self, logger, caplog):
      """
      Show that redacting password works in context exceptions.
      """
      exception = None
      try:
          raise RuntimeError(f"Cannot connect to user:{p}")
      except RuntimeError as ex:
          exception = ex
      try:
          raise RuntimeError(f"Exception: {exception}") from exception
      except RuntimeError:
          logger.exception("Err")
  
      line = lineno() - 8
  
      assert caplog.text == textwrap.dedent(
          f"""\
              ERROR Err
              Traceback (most recent call last):
                File ".../test_secrets_masker.py", line {line}, in test_masking_in_explicit_context_exceptions
                  raise RuntimeError(f"Cannot connect to user:{{p}}")
              RuntimeError: Cannot connect to user:***
  
              The above exception was the direct cause of the following exception:
  
              Traceback (most recent call last):
                File ".../test_secrets_masker.py", line {line+4}, in test_masking_in_explicit_context_exceptions
                  raise RuntimeError(f"Exception: {{exception}}") from exception
              RuntimeError: Exception: Cannot connect to user:***
              """
      )
  
imports: from __future__ import annotations
  import contextlib
  import inspect
  import logging
  import logging.config
  import os
  import sys
  import textwrap
  from enum import Enum
  from io import StringIO
  from unittest.mock import patch
  import pytest
  from airflow import settings
  from airflow.utils.log.secrets_masker import RedactedIO, SecretsMasker, mask_secret, redact, should_hide_value_for_key
  from airflow.utils.state import DagRunState, JobState, State, TaskInstanceState
  from tests.test_utils.config import conf_vars
label_desc: Use image node_id 8 for calling the TestSecretsMasker obj's underlying member method code with example usage: obj.test_masking_in_explicit_context_exceptions(logger, caplog) without return types