Revert "Adding entries of Call Stack Manager in StudentModule and StudentModuleHistory"
This commit is contained in:
@@ -27,7 +27,7 @@ How to use-
|
||||
4. Decorator is a parameterized decorator with class name/s as argument
|
||||
How to use -
|
||||
1. Import following
|
||||
from openedx.core.djangoapps.call_stack_manager import donottrack
|
||||
import from openedx.core.djangoapps.call_stack_manager import donottrack
|
||||
"""
|
||||
|
||||
import logging
|
||||
@@ -132,15 +132,13 @@ def donottrack(*classes_not_to_be_tracked):
|
||||
global TRACK_FLAG # pylint: disable=W0603
|
||||
current_flag = TRACK_FLAG
|
||||
TRACK_FLAG = False
|
||||
return_value = function(*args, **kwargs)
|
||||
function(*args, **kwargs)
|
||||
TRACK_FLAG = current_flag
|
||||
return return_value
|
||||
else:
|
||||
global HALT_TRACKING # pylint: disable=W0603
|
||||
current_halt_track = HALT_TRACKING
|
||||
HALT_TRACKING = classes_not_to_be_tracked
|
||||
return_value = function(*args, **kwargs)
|
||||
function(*args, **kwargs)
|
||||
HALT_TRACKING = current_halt_track
|
||||
return return_value
|
||||
return wrapper
|
||||
return real_donottrack
|
||||
|
||||
@@ -109,13 +109,6 @@ def donottrack_func_child():
|
||||
ModelMixin.objects.all()
|
||||
|
||||
|
||||
@donottrack()
|
||||
def donottrack_check_with_return():
|
||||
""" function that returns something i.e. a wrapped function returning some value
|
||||
"""
|
||||
return 42
|
||||
|
||||
|
||||
@patch('openedx.core.djangoapps.call_stack_manager.core.log.info')
|
||||
@patch('openedx.core.djangoapps.call_stack_manager.core.REGULAR_EXPS', [])
|
||||
class TestingCallStackManager(TestCase):
|
||||
@@ -220,11 +213,3 @@ class TestingCallStackManager(TestCase):
|
||||
for __ in range(1, 5):
|
||||
ModelMixinCallStckMngr(id_field=1).save()
|
||||
self.assertEqual(len(log_capt.call_args_list), 1)
|
||||
|
||||
def test_donottrack_with_return(self, log_capt):
|
||||
""" Test for @donottrack
|
||||
Checks if wrapper function returns the same value as wrapped function
|
||||
"""
|
||||
everything = donottrack_check_with_return()
|
||||
self.assertEqual(everything, 42)
|
||||
self.assertEqual(len(log_capt.call_args_list), 0)
|
||||
|
||||
Reference in New Issue
Block a user