Few pyLint issues fixed

pull/420/head
Przemek Wirkus 2014-07-28 17:46:21 +01:00
parent dc12ff6bba
commit d0cd53e29f
1 changed files with 22 additions and 21 deletions

View File

@ -220,11 +220,11 @@ class SingleTestRunner(object):
return self.shuffle_random_seed return self.shuffle_random_seed
def is_float(self, value): def is_shuffle_seed_float(self):
""" return true if function parameter can be converted to float """ """ return true if function parameter can be converted to float """
result = True result = True
try: try:
float(value) float(self.shuffle_random_seed)
except ValueError: except ValueError:
result = False result = False
return result return result
@ -238,7 +238,7 @@ class SingleTestRunner(object):
test_summary = [] test_summary = []
# Generate seed for shuffle if seed is not provided in # Generate seed for shuffle if seed is not provided in
self.shuffle_random_seed = round(random.random(), self.SHUFFLE_SEED_ROUND) self.shuffle_random_seed = round(random.random(), self.SHUFFLE_SEED_ROUND)
if self.opts_shuffle_test_seed is not None and self.is_float(self.opts_shuffle_test_seed): if self.opts_shuffle_test_seed is not None and self.is_shuffle_seed_float():
self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND) self.shuffle_random_seed = round(float(self.opts_shuffle_test_seed), self.SHUFFLE_SEED_ROUND)
for target, toolchains in self.test_spec['targets'].iteritems(): for target, toolchains in self.test_spec['targets'].iteritems():
@ -412,7 +412,8 @@ class SingleTestRunner(object):
single_test.TEST_RESULT_IOERR_DISK : 0, single_test.TEST_RESULT_IOERR_DISK : 0,
single_test.TEST_RESULT_IOERR_SERIAL : 0, single_test.TEST_RESULT_IOERR_SERIAL : 0,
single_test.TEST_RESULT_NO_IMAGE : 0, single_test.TEST_RESULT_NO_IMAGE : 0,
single_test.TEST_RESULT_TIMEOUT : 0 } single_test.TEST_RESULT_TIMEOUT : 0
}
for test in test_summary: for test in test_summary:
if test[0] in result_dict: if test[0] in result_dict:
@ -480,7 +481,7 @@ class SingleTestRunner(object):
result = False result = False
return result, resutl_msg, copy_method return result, resutl_msg, copy_method
def delete_file(file_path): def delete_file(self, file_path):
""" Remove file from the system """ """ Remove file from the system """
result = True result = True
resutl_msg = "" resutl_msg = ""
@ -590,10 +591,10 @@ class SingleTestRunner(object):
cmd = ["python", "%s.py" % name, '-p', port, '-d', disk, '-t', str(duration), "-e", extra_serial] cmd = ["python", "%s.py" % name, '-p', port, '-d', disk, '-t', str(duration), "-e", extra_serial]
proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS) proc = Popen(cmd, stdout=PIPE, cwd=HOST_TESTS)
obs = ProcessObserver(proc) obs = ProcessObserver(proc)
start = time() start_time = time()
line = '' line = ''
output = [] output = []
while (time() - start) < duration: while (time() - start_time) < duration:
try: try:
c = obs.queue.get(block=True, timeout=1) c = obs.queue.get(block=True, timeout=1)
except Empty, _: except Empty, _:
@ -872,7 +873,7 @@ def progress_bar(percent_progress, saturation=0):
step = int(percent_progress / 2) # Scale by to (scale: 1 - 50) step = int(percent_progress / 2) # Scale by to (scale: 1 - 50)
str_progress = '#' * step + '.' * int(50 - step) str_progress = '#' * step + '.' * int(50 - step)
c = '!' if str_progress[38] == '.' else '|' c = '!' if str_progress[38] == '.' else '|'
if (saturation > 0): if saturation > 0:
saturation = saturation / 2 saturation = saturation / 2
str_progress = str_progress[:saturation] + c + str_progress[saturation:] str_progress = str_progress[:saturation] + c + str_progress[saturation:]
return str_progress return str_progress