def SetStateFromPhaseOutcome(self, phase_outcome):
    # Handle a few cases where the test is ending prematurely.
    if phase_outcome.raised_exception:
      self.record.outcome = test_record.Outcome.ERROR
      code = str(type(phase_outcome.phase_result).__name__)
      description = str(phase_outcome.phase_result).decode('utf8', 'replace')
      self.record.AddOutcomeDetails(code, description)
      self._state = self.State.COMPLETED
    elif phase_outcome.is_timeout:
      self.record.outcome = test_record.Outcome.TIMEOUT
      self._state = self.State.COMPLETED
    elif phase_outcome.phase_result == openhtf.PhaseResult.FAIL:
      self.record.outcome = test_record.Outcome.FAIL
      self._state = self.State.COMPLETED

    return self._state == self.State.COMPLETED
Cascaded deletions of Foreign Key relations issue queries on the right database
dataset/ETHPy150Open google/openhtf/openhtf/exe/test_state.py/TestState.SetStateFromPhaseOutcome--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/regressiontests/multiple_database/tests.py/QueryTestCase.test_foreign_key_deletion