move properties storage from dict to fields for StepperStatus

This commit is contained in:
Alexey Lavrenuke (load testing) 2013-07-23 14:33:38 +04:00
parent bf96914324
commit f2c5013f72
2 changed files with 11 additions and 8 deletions

View File

@ -65,6 +65,8 @@ class StepperStatus(object):
'duration': None,
'ammo_count': 0,
}
self._ammo_count = 0
self._loop_count = 0
self.loop_limit = None
self.ammo_limit = None
@ -77,13 +79,11 @@ class StepperStatus(object):
@property
def ammo_count(self):
# return self._ammo_count
return self.info['ammo_count']
return self._ammo_count
@ammo_count.setter
def ammo_count(self, value):
# self._ammo_count = value
self.info['ammo_count'] = value
self._ammo_count = value
if self.ammo_limit and value > self.ammo_limit:
raise StopIteration
@ -92,13 +92,11 @@ class StepperStatus(object):
@property
def loop_count(self):
# return self._loop_count
return self.info['loop_count']
return self._loop_count
@loop_count.setter
def loop_count(self, value):
# self._loop_count = value
self.info['loop_count'] = value
self._loop_count = value
if self.loop_limit and value > self.loop_limit:
raise StopIteration
@ -106,6 +104,8 @@ class StepperStatus(object):
self.loop_count += 1
def get_info(self):
self.info['ammo_count'] = self._ammo_count
self.info['loop_count'] = self._loop_count
for key in self.info:
if self.info[key] is None:
raise RuntimeError(

View File

@ -11,6 +11,9 @@ class InstanceLP(object):
def __init__(self, duration=0):
self.duration = float(duration)
def get_duration(self):
return int(self.duration) # needed for Composite LP
class Empty(InstanceLP):