Skip to content

Commit

Permalink
Pylint W0702: No exception type(s) specified (bare-except)
Browse files Browse the repository at this point in the history
If you want to catch all exceptions that signal program errors, use ``except Exception:``

Signed-off-by: Soyeon Park <[email protected]>
  • Loading branch information
sypark9646 committed Sep 4, 2023
1 parent dad40ea commit ff7dd4c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def is_32bit(filename):

if ei_class == ELFCLASS32:
return True
except:
except Exception:
pass

return False
Expand Down Expand Up @@ -63,7 +63,7 @@ def get_elf_machine(filename):
e_machine = ord(e_machine)

return machine[e_machine]
except:
except Exception:
pass

return None
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_feature(self):
for i in range(3, len(s) - 1):
self.feature.add(s[i])
return True
except:
except Exception:
return False

def convert_abs_path(self, build_cmd):
Expand Down Expand Up @@ -185,7 +185,7 @@ def build_it(self, build_cmd):
except OSError as e:
self.pr_debug(e.strerror)
return TestBase.TEST_BUILD_FAIL
except:
except Exception:
return TestBase.TEST_BUILD_FAIL

def build(self, name, cflags='', ldflags=''):
Expand Down Expand Up @@ -332,7 +332,7 @@ def task_sort(self, output, ignore_children=False):
m = pid_patt.match(ln)
try:
pid = int(m.group(1))
except:
except Exception:
continue

func = ln.split('|', 1)[-1]
Expand All @@ -352,7 +352,7 @@ def task_sort(self, output, ignore_children=False):
for p in pid_list:
result += '\n'.join(pids[p]['result']) + '\n'
result = result.strip()
except:
except Exception:
pass # this leads to a failure with 'NG'
return result

Expand Down Expand Up @@ -387,7 +387,7 @@ def report_sort(self, output, ignored):
try:
if line[-1].startswith('__'):
continue
except:
except Exception:
pass
result.append('%s %s' % (line[-2], line[-1]))

Expand Down Expand Up @@ -464,7 +464,7 @@ def chrome_sort(self, output, ignored):
result = []
try:
o = json.loads(output)
except:
except Exception:
return ''
for ln in o['traceEvents']:
if ln['name'].startswith('__'):
Expand Down Expand Up @@ -539,7 +539,7 @@ def check_perf_paranoid(self):

if v >= 3:
return False
except:
except Exception:
pass

return True
Expand Down Expand Up @@ -692,7 +692,7 @@ def timeout_handler(sig, frame):
dif = "%s: diff result of %s %s\n" % (name, compiler, cflags)
try:
p = sp.Popen(['colordiff', '-U1', 'expect', 'result'], stdout=sp.PIPE)
except:
except Exception:
p = sp.Popen(['diff', '-U1', 'expect', 'result'], stdout=sp.PIPE)
dif += p.communicate()[0].decode(errors='ignore')
os.remove('expect')
Expand Down

0 comments on commit ff7dd4c

Please sign in to comment.