Skip to content

Commit

Permalink
flake8: E722 do not use bare except
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeySanko committed Oct 27, 2017
1 parent 3aecee0 commit 699404b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/main/python/pybuilder/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def execute_task(self, task, **keyword_arguments):
number_of_actions += 1

task.execute(self.logger, keyword_arguments)
except:
except Exception:
if not has_teardown_tasks:
raise
else:
Expand All @@ -307,7 +307,7 @@ def execute_task(self, task, **keyword_arguments):
if not task_error or action.teardown:
if self.execute_action(action, keyword_arguments):
number_of_actions += 1
except:
except Exception:
if not has_teardown_tasks:
raise
elif task_error:
Expand Down
4 changes: 2 additions & 2 deletions src/main/python/pybuilder/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,13 @@ def instrumented_target(*args, **kwargs):
ex = tb = None
try:
send_value = (target(*args, **kwargs), None, None)
except:
except Exception:
_, ex, tb = sys.exc_info()
send_value = (None, ex, tb)

try:
q.put(send_value)
except:
except Exception:
_, send_ex, send_tb = sys.exc_info()
e_out = Exception(str(send_ex), send_tb, None if ex is None else str(ex), tb)
q.put(e_out)
Expand Down
8 changes: 4 additions & 4 deletions src/unittest/python/utils_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ def test_func():
val = fork_process(Mock(), target=test_func)
val = fork_process(Mock(), target=test_func)
self.fail("should not have reached here, returned %s" % val)
except:
except Exception:
ex_type, ex, tb = sys.exc_info()
self.assertEquals(ex_type, PyBuilderException)
self.assertEquals(ex.message, "Test failure message")
Expand All @@ -374,7 +374,7 @@ def test_func():
try:
fork_process(Mock(), target=test_func)
self.fail("should not have reached here")
except:
except Exception:
ex_type, ex, tb = sys.exc_info()
self.assertEquals(ex_type, Exception)
self.assertTrue(str(ex).startswith("Fatal error occurred in the forked process"))
Expand All @@ -392,7 +392,7 @@ def test_func():
try:
val = fork_process(Mock(), target=test_func)
self.fail("should not have reached here, returned %s" % val)
except:
except Exception:
ex_type, ex, tb = sys.exc_info()
self.assertEquals(ex_type, Exception)
self.assertTrue(str(ex).startswith("Fatal error occurred in the forked process"))
Expand All @@ -415,7 +415,7 @@ def test_func():
try:
val = fork_process(Mock(), target=test_func)
self.fail("should not have reached here, returned %s" % val)
except:
except Exception:
ex_type, ex, tb = sys.exc_info()
self.assertEquals(ex_type, Exception)
self.assertTrue(str(ex).startswith("Fatal error occurred in the forked process"))
Expand Down

0 comments on commit 699404b

Please sign in to comment.