Skip to content

Commit e1052d2

Browse files
Merge pull request #3604 from VWS-Python/type-context-manager-exception
Type context manager exceptions explicitly
2 parents 7d48da8 + bf49cc7 commit e1052d2

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/mock_vws/decorators.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from collections.abc import Callable, Generator, Mapping
88
from contextlib import contextmanager
99
from dataclasses import dataclass
10+
from types import TracebackType
1011
from typing import TYPE_CHECKING, Literal, Self
1112
from urllib.parse import urlparse
1213

@@ -558,16 +559,17 @@ def __enter__(self) -> Self:
558559
self._started.append((mock, router, httpx2_router))
559560
return self
560561

561-
def __exit__(self, *exc: object) -> Literal[False]:
562+
def __exit__(
563+
self,
564+
_exc_type: type[BaseException] | None,
565+
_exc_value: BaseException | None,
566+
_traceback: TracebackType | None,
567+
) -> Literal[False]:
562568
"""Stop the Vuforia mock.
563569
564570
Returns:
565571
False
566572
"""
567-
# __exit__ needs this to be passed in but vulture thinks that it is
568-
# unused, so we "use" it here.
569-
del exc
570-
571573
mock, router, httpx2_router = self._started.pop()
572574
mock.stop()
573575
router.stop()

0 commit comments

Comments
 (0)