py.test patch on fixture
I’d say patching via decorator is not the optimal approach here. I’d use the context manager: import pytest from unittest.mock import patch @pytest.fixture(autouse=True) def no_delay(): with patch(‘ConstantsModule.ConstantsClass.DELAY_TIME’, 10): yield This way, patching is cleanly reverted on test teardown.