Skip to content

Commit

Permalink
Addressing post-merge comments on PR#771 (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdsudac authored and Kenadia committed May 4, 2018
1 parent 148a6c6 commit 71ab98d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
26 changes: 12 additions & 14 deletions openhtf/core/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ class TestExecutor(threads.KillableThread):
daemon = True

def __init__(self, test_descriptor, execution_uid, test_start, test_options):
# DO NOT SUBMIT remove comment below.
# default_dut_id, teardown_function=None, failure_exceptions=None):
super(TestExecutor, self).__init__(name='TestExecutorThread')
self.test_state = None

Expand Down Expand Up @@ -198,18 +196,18 @@ def _execute_test_start(self, phase_exec):
def _execute_test_teardown(self, phase_exec):
phase_exec.stop(timeout_s=conf.cancel_timeout_s)
phase_exec.reset_stop()
try:
timeout_s = self._test_options.teardown_function.options.timeout_s
except AttributeError:
# Force teardown function timeout, otherwise we can hang for a long time
# when shutting down, such as in response to a SIGINT.
timeout_s = conf.teardown_timeout_s

teardown_function = (
self._test_options.teardown_function and
openhtf.PhaseDescriptor.wrap_or_copy(
self._test_options.teardown_function, timeout_s=timeout_s))
if self._do_teardown_function and teardown_function:

if self._do_teardown_function and self._test_options.teardown_function:
try:
timeout_s = self._test_options.teardown_function.options.timeout_s
except AttributeError:
# Force teardown function timeout, otherwise we can hang for a long time
# when shutting down, such as in response to a SIGINT.
timeout_s = conf.teardown_timeout_s

teardown_function = openhtf.PhaseDescriptor.wrap_or_copy(
self._test_options.teardown_function, timeout_s=timeout_s)

outcome = phase_exec.execute_phase(teardown_function)
# Ignore teardown phase outcome if there is already a terminal error.
if not self._latest_outcome or not self._latest_outcome.is_terminal:
Expand Down
2 changes: 0 additions & 2 deletions openhtf/core/test_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,6 @@ def _is_aborted(self):
return False

def _outcome_is_failure_exception(self, outcome):
if not self.test_options.failure_exceptions:
return False
for failure_exception in self.test_options.failure_exceptions:
if isinstance(outcome.phase_result.exc_val, failure_exception):
return True
Expand Down

0 comments on commit 71ab98d

Please sign in to comment.