Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
spacemanspiff2007 committed Dec 6, 2024
1 parent 256a1a2 commit e47d5bb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions run/conf_testing/lib/HABAppTests/test_rule/test_case.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import functools
import logging
from asyncio import sleep
from collections.abc import Callable
from collections.abc import Callable, Coroutine, Sequence
from inspect import iscoroutinefunction
from typing import Optional, Type, Any, Final
from collections.abc import Coroutine, Sequence
from types import TracebackType
from typing import Any, Final

import HABApp
from HABApp.core.events import NoEventFilter
from HABApp.core.internals import EventBusListener, WrappedFunctionBase, wrap_func
from HABAppTests.test_rule._com_patcher import BasePatcher, MqttPatcher, RestPatcher, SsePatcher
from HABAppTests.test_rule.test_result import TestResult, TestResultStatus
from HABAppTests.utils import get_file_path_of_obj
from types import TracebackType


class TmpLogLevel:
Expand All @@ -24,7 +23,7 @@ def __enter__(self) -> None:
self.old = self.log.level
self.log.setLevel(logging.INFO)

def __exit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool:
def __exit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> bool:
self.log.setLevel(self.old)
return False

Expand Down Expand Up @@ -55,7 +54,7 @@ async def __aenter__(self):

return self

async def __aexit__(self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]) -> bool:
async def __aexit__(self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None) -> bool:
if (ebl := self._listener) is not None:
self._listener = None
with TmpLogLevel('HABApp'):
Expand Down

0 comments on commit e47d5bb

Please sign in to comment.