I am getting this error while I am trying to run unit test case using pytest. It works fine in my project but raises an error while running test case.
My code is as following:
def saveEvents(request, request_data):
transaction.set_autocommit(autocommit=False)
try:
# here is my code
except Exception as inst:
transaction.rollback()
# code
transaction.commit()
return something
I read all the solutions of this type of questions, but I am puzzled why its not working with pytest. Please help.