What's the difference between using @patch above the testing function or with patch within the testing function (example below). For context, I'm testing a function where patching using a with statement works as expected, but the @patch doesn't.
class MyClass:
def __init__(self, arg_a, arg_b):
self.arg_a = arg_a
self.arg_b = arg_b
def function_to_test(self):
pass
@patch(
"my_path",
return_value=None,
)
def test_function_to_test(
mock_,
):
with patch("my_path") as mock_:
pass