11"""Decoy test double stubbing and verification library."""
22from os import linesep
33from typing import cast , Any , Optional , Sequence , Type
4- from warnings import warn
54
65from .registry import Registry
76from .spy import create_spy , SpyCall
87from .stub import Stub
98from .types import ClassT , FuncT , ReturnT
10- from .warnings import MissingStubWarning
119
1210
1311class Decoy :
1412 """Decoy test double state container."""
1513
1614 _registry : Registry
17- _warn_on_missing_stubs : bool
1815
19- def __init__ (
20- self ,
21- warn_on_missing_stubs : bool = True ,
22- ) -> None :
16+ def __init__ (self ) -> None :
2317 """Initialize the state container for test doubles and stubs.
2418
2519 You should initialize a new Decoy instance for every test.
2620
27- Arguments:
28- warn_on_missing_stubs: Trigger a warning if a stub is called
29- with arguments that do not match any of its rehearsals.
30-
3121 Example:
3222 ```python
3323 import pytest
@@ -39,7 +29,6 @@ def decoy() -> Decoy:
3929 ```
4030 """
4131 self ._registry = Registry ()
42- self ._warn_on_missing_stubs = warn_on_missing_stubs
4332
4433 def create_decoy (self , spec : Type [ClassT ], * , is_async : bool = False ) -> ClassT :
4534 """Create a class decoy for `spec`.
@@ -189,9 +178,6 @@ def _handle_spy_call(self, call: SpyCall) -> Any:
189178 if stub ._rehearsal == call :
190179 return stub ._act ()
191180
192- if self ._warn_on_missing_stubs and len (stubs ) > 0 :
193- warn (MissingStubWarning (call , stubs ))
194-
195181 return None
196182
197183 def _build_verify_error (
0 commit comments