Overriding decorator during unit test in python
问题 I have a django class based view that I'm decorating. Unfortunately that decorator makes outside calls to do status checks which is outside the scope of what the unit test should do so I want to override the decorator to do nothing during my unit tests. Here is my decorator: decorators.py def status_check(func): @wraps(func) def wrapped(request, *args, **kwargs): uri = settings.SERVER_URI status_code = None bad_status = [404, 500] try: response = requests.head(uri) except requests