From f6a026d95284bcbf90a2c537a3935087eaab4dc8 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Mon, 31 Aug 2020 15:23:38 -0500 Subject: [PATCH] Add wraps keyword to make_mock_fixture() --- src/pgwui_testing/testing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pgwui_testing/testing.py b/src/pgwui_testing/testing.py index 92f8c3d..23cad3b 100644 --- a/src/pgwui_testing/testing.py +++ b/src/pgwui_testing/testing.py @@ -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 -- 2.34.1