In python, how can I add a patch that does not add a mock input argument?
I want to add a patch on all methods in a class like so:
@patch('django.utils.timezone.now', return_value=datetime.datetime(2022, 4, 22, tzinfo=timezone.utc))
class TestmanyMethods(unittest.TestCase):
# my test methods here
But when I do that, a mock must be added to all test methods. How can I patch the function without adding the mock input to all test methods?
source https://stackoverflow.com/questions/72636788/in-python-how-can-i-add-a-patch-decorator-that-does-not-add-a-mock-input-argume
Comments
Post a Comment