pylint warnings

This commit is contained in:
Andrey Pohilko 2013-03-15 15:04:41 +04:00
parent dcb2ad84d0
commit 69deb89b7b
4 changed files with 15 additions and 14 deletions

View File

@ -356,7 +356,7 @@ class QuantileCriteria(AbstractCriteria):
def notify(self, aggregate_second):
if not (self.quantile in aggregate_second.overall.quantiles.keys()):
self.log.warning("No qunatile %s in %s", self.timing, aggregate_second.overall.quantiles)
self.log.warning("No quantile %s in %s", self.quantile, aggregate_second.overall.quantiles)
if self.quantile in aggregate_second.overall.quantiles.keys() \
and aggregate_second.overall.quantiles[self.quantile] > self.rt_limit:
if not self.seconds_count:

View File

@ -28,7 +28,7 @@ class JMeterPlugin(AbstractPlugin):
self.user_args = None
self.jmeter_path = None
self.jmeter_log = None
self.start_time=time.time()
self.start_time = time.time()
@staticmethod
@ -77,8 +77,8 @@ class JMeterPlugin(AbstractPlugin):
def start_test(self):
self.log.info("Starting %s with arguments: %s", self.jmeter_path, self.args)
self.jmeter_process = subprocess.Popen(self.args, executable=self.jmeter_path, preexec_fn=os.setsid, close_fds=True) # stderr=subprocess.PIPE, stdout=subprocess.PIPE,
self.start_time=time.time()
self.jmeter_process = subprocess.Popen(self.args, executable=self.jmeter_path, preexec_fn=os.setsid, close_fds=True) # stderr=subprocess.PIPE, stdout=subprocess.PIPE,
self.start_time = time.time()
def is_test_finished(self):
@ -97,7 +97,7 @@ class JMeterPlugin(AbstractPlugin):
os.killpg(self.jmeter_process.pid, signal.SIGTERM)
except OSError, exc:
self.log.debug("Seems JMeter exited itself: %s", exc)
#Utils.log_stdout_stderr(self.log, self.jmeter_process.stdout, self.jmeter_process.stderr, "jmeter")
# Utils.log_stdout_stderr(self.log, self.jmeter_process.stdout, self.jmeter_process.stderr, "jmeter")
self.core.add_artifact_file(self.jmeter_log)
return retcode
@ -106,7 +106,7 @@ class JMeterPlugin(AbstractPlugin):
def __add_writing_section(self, jmx, jtl):
''' Genius idea by Alexey Lavrenyuk '''
self.log.debug("Original JMX: %s", os.path.realpath(jmx))
src_jmx=open(jmx, 'r')
src_jmx = open(jmx, 'r')
source_lines = src_jmx.readlines()
src_jmx.close()
try:
@ -117,7 +117,7 @@ class JMeterPlugin(AbstractPlugin):
except Exception, exc:
raise RuntimeError("Failed to find the end of JMX XML: %s" % exc)
tpl_file=open(os.path.dirname(__file__) + '/jmeter_writer.xml', 'r')
tpl_file = open(os.path.dirname(__file__) + '/jmeter_writer.xml', 'r')
tpl = tpl_file.read()
tpl_file.close()
@ -172,7 +172,7 @@ class JMeterReader(AbstractReader):
line = line.strip()
if not line:
return None
#timeStamp,elapsed,label,responseCode,success,bytes,grpThreads,allThreads,Latency
# timeStamp,elapsed,label,responseCode,success,bytes,grpThreads,allThreads,Latency
data = line.split("\t")
if len(data) != 9:
self.log.warning("Wrong jtl line, skipped: %s", line)
@ -234,7 +234,7 @@ class JMeterInfoWidget(AbstractInfoWidget, AggregateResultListener):
''' Right panel widget with JMeter test info '''
def __init__(self, jmeter):
AbstractInfoWidget.__init__(self)
self.krutilka=ConsoleScreen.krutilka()
self.krutilka = ConsoleScreen.krutilka()
self.jmeter = jmeter
self.active_threads = 0
self.rps = 0
@ -253,7 +253,7 @@ class JMeterInfoWidget(AbstractInfoWidget, AggregateResultListener):
right_spaces = space / 2
dur_seconds = int(time.time()) - int(self.jmeter.start_time)
duration=str(datetime.timedelta(seconds=dur_seconds))
duration = str(datetime.timedelta(seconds=dur_seconds))
template = screen.markup.BG_MAGENTA + '~' * left_spaces + jmeter + ' ' + '~' * right_spaces + screen.markup.RESET + "\n"
template += " Test Plan: %s\n"

View File

@ -413,9 +413,7 @@ class PhantomReader(AbstractReader):
self.log.debug("Instances info buffer size: %s", len(self.stat_data))
def __read_phout_data(self, force):
'''
Read phantom results
'''
''' Read phantom results '''
if self.phout and len(self.data_queue) < self.buffered_seconds * 2:
self.log.debug("Reading phout, up to 10MB...")
phout = self.phout.readlines(10 * 1024 * 1024)
@ -445,7 +443,7 @@ class PhantomReader(AbstractReader):
tstmp = float(data[0])
cur_time = int(tstmp + float(rt_real) / 1000000)
if cur_time in self.stat_data.keys(): # FIXME: optimize
if cur_time in self.stat_data.keys():
active = self.stat_data[cur_time]
else:
active = 0
@ -491,6 +489,7 @@ class PhantomReader(AbstractReader):
def __aggregate_next_second(self):
''' calls aggregator if there is data '''
parsed_sec = AbstractReader.pop_second(self)
if parsed_sec:
self.pending_second_data_queue.append(parsed_sec)
@ -502,6 +501,7 @@ class PhantomReader(AbstractReader):
def __process_pending_second(self):
''' process data in queue '''
next_time = int(time.mktime(self.pending_second_data_queue[0].time.timetuple()))
if self.last_sample_time and (next_time - self.last_sample_time) > 1:
self.last_sample_time += 1

View File

@ -496,6 +496,7 @@ class QuantileOfSaturationCriteria(AbstractCriteria):
def __get_timing_quantile(self, aggr_data):
''' get quantile level for criteria timing '''
quan = 0.0
for timing in sorted(aggr_data.cumulative.times_dist.keys()):
timing_item = aggr_data.cumulative.times_dist[timing]