Now that we can know whether the code in running under DEBUG mode:
https://stackoverflow.com/a/16648628/2544762
But at the same time, when we run the code in a unittest, we always got debug == False
.
https://docs.djangoproject.com/en/4.1/topics/testing/overview/#other-test-conditions
In my own case, I just really want to make some code under debug condition, and want it to be tested with debug == True
, how can I do?
So, is there any way to detect whether the code is running with test? In any place.