def test_debug(self): """ Testing debug """ settings.DEBUG = True self.func() self.assertTrue(self.func_called) settings.DEBUG = False