From 83dc927c4813c787ba817713930ec6d76bd9b130 Mon Sep 17 00:00:00 2001 From: Jelmer Draaijer Date: Wed, 25 Oct 2023 23:04:15 +0200 Subject: [PATCH] Replace patching with monkeypatch + MagicMock --- requirements/test.txt | 1 - t/unit/conftest.py | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/requirements/test.txt b/requirements/test.txt index 4c0c39ce..790116d4 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,4 +1,3 @@ -case>=1.3.1 pytest-django>=4.5.2,<5.0 pytest>=6.2.5,<8.0 pytest-timeout diff --git a/t/unit/conftest.py b/t/unit/conftest.py index 5e3f9440..a4f34c7e 100644 --- a/t/unit/conftest.py +++ b/t/unit/conftest.py @@ -1,3 +1,5 @@ +from unittest.mock import MagicMock + import pytest # we have to import the pytest plugin fixtures here, # in case user did not do the `python setup.py develop` yet, @@ -40,3 +42,11 @@ def add(x, y): yield if request.instance: request.instance.app = None + + +@pytest.fixture +def patching(monkeypatch): + def _patching(attr): + monkeypatch.setattr(attr, MagicMock()) + + return _patching