Add wraps keyword to make_mock_fixture()
authorKarl O. Pinc <kop@karlpinc.com>
Mon, 31 Aug 2020 20:23:38 +0000 (15:23 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Mon, 31 Aug 2020 20:23:38 +0000 (15:23 -0500)
src/pgwui_testing/testing.py

index 92f8c3d538962fb9a79e241a7e01007fce790dba..23cad3bd3f31f5020e2f3026ab0d6f2fb4e4984c 100644 (file)
@@ -77,14 +77,14 @@ def pgwui_check_settings_entry_point():
 
 # Mock support
 
-def make_mock_fixture(module, method, autouse=False):
+def make_mock_fixture(module, method, autouse=False, wraps=None):
     '''Returns a pytest fixture that mocks a module's method or a class's
     class method.  "module" is a module or a class, but method is a string.
     '''
     @fixture(autouse=autouse)
     def fix(monkeypatch):
         mocked = mock.Mock(
-            spec=getattr(module, method), name=method)
+            spec=getattr(module, method), name=method, wraps=wraps)
         monkeypatch.setattr(module, method, mocked)
         return mocked
     return fix