mirror of
https://github.com/valitydev/yandex-tank.git
synced 2024-11-06 10:25:17 +00:00
move properties storage from dict to fields for StepperStatus
This commit is contained in:
parent
bf96914324
commit
f2c5013f72
@ -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(
|
||||
|
@ -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):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user