Skip to content

Commit

Permalink
Rename utils.catch_warnings to catch_warnings_safe
Browse files Browse the repository at this point in the history
  • Loading branch information
seberm authored and psss committed Dec 9, 2024
1 parent 6fa638f commit 5cac74d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tmt/steps/report/reportportal.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import tmt.steps.report
import tmt.utils
from tmt.result import ResultOutcome
from tmt.utils import ActionType, catch_warnings, field, format_timestamp, yaml_to_dict
from tmt.utils import ActionType, catch_warnings_safe, field, format_timestamp, yaml_to_dict

if TYPE_CHECKING:
from tmt._compat.typing import TypeAlias
Expand Down Expand Up @@ -778,7 +778,7 @@ def go(self, *, logger: Optional[tmt.log.Logger] = None) -> None:
self.warn("SSL verification is disabled for all requests being made to ReportPortal "
f"instance ({self.data.url}).")

with catch_warnings(
with catch_warnings_safe(
action=warning_filter_action,
category=urllib3.exceptions.InsecureRequestWarning):
self.execute_rp_import()
4 changes: 2 additions & 2 deletions tmt/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6289,7 +6289,7 @@ def is_url(url: str) -> bool:


@contextlib.contextmanager
def catch_warnings(
def catch_warnings_safe(
action: ActionType,
category: type[Warning] = Warning) -> Iterator[None]:
"""
Expand All @@ -6305,7 +6305,7 @@ def catch_warnings(
.. code-block:: python
with catch_warnings('ignore', urllib3.exceptions.InsecureRequestWarning):
with catch_warnings_safe('ignore', urllib3.exceptions.InsecureRequestWarning):
...
"""
with _catch_warning_lock, warnings.catch_warnings():
Expand Down

0 comments on commit 5cac74d

Please sign in to comment.