Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,29 @@
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.


===============================================================================
License for angular
===============================================================================
The MIT License

Copyright (c) 2010-2022 Google LLC. https://angular.io/license

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
1 change: 0 additions & 1 deletion examples/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion openhtf/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

33 changes: 15 additions & 18 deletions openhtf/core/phase_branches.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class PreviousPhases(enum.Enum):
ALL = 'ALL'

# Check all previous phases in the current subtest.
SUBTEST = "SUBTEST"
SUBTEST = 'SUBTEST'


def _not_any(iterable: Iterator[bool]) -> bool:
Expand Down Expand Up @@ -183,20 +183,19 @@ def apply_to_all_phases(
return self

def get_result(
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None
) -> phase_descriptor.PhaseReturnT:
if self._check_for_action(running_test_state, subtest_rec):
return self.action
return phase_descriptor.PhaseResult.CONTINUE

@abc.abstractmethod
def _check_for_action(
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None
) -> bool:
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None) -> bool:
"""Returns True when the action should be taken."""

@abc.abstractmethod
Expand Down Expand Up @@ -244,20 +243,19 @@ def _phase_failed(self, phase_rec: test_record.PhaseRecord) -> bool:
return phase_rec.outcome == test_record.PhaseOutcome.FAIL

def _check_for_action(
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None
) -> bool:
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None) -> bool:
"""Returns True when the specific set of phases fail."""
phase_records = running_test_state.test_record.phases
if not phase_records:
raise NoPhasesFoundError('No phases found in the test record.')
if self.previous_phases_to_check == PreviousPhases.LAST:
return self._phase_failed(phase_records[-1])
elif (self.previous_phases_to_check == PreviousPhases.SUBTEST and
elif (self.previous_phases_to_check == PreviousPhases.SUBTEST and
subtest_rec is not None):
for phase_rec in phase_records:
if (phase_rec.subtest_name == subtest_rec.name and
if (phase_rec.subtest_name == subtest_rec.name and
self._phase_failed(phase_rec)):
return True
else:
Expand Down Expand Up @@ -286,10 +284,9 @@ def _asdict(self) -> Dict[Text, Any]:
return ret

def _check_for_action(
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None
) -> bool:
self,
running_test_state: 'test_state.TestState',
subtest_rec: Optional[test_record.SubtestRecord] = None) -> bool:
"""Returns True if the condition is true."""
return self.diag_condition.check(running_test_state.diagnoses_manager.store)

Expand Down
1 change: 0 additions & 1 deletion openhtf/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion openhtf/output/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion openhtf/output/servers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion openhtf/output/web_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion openhtf/plugs/generic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

1 change: 0 additions & 1 deletion pylint_plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

64 changes: 34 additions & 30 deletions test/core/phase_branches_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,7 @@ def test_last_fail_subtest__fail_in_subtest(self):
@htf_test.yields_phases
def test_subtest_previous_fail__fail(self):
test_rec = yield htf.Test(
fail_phase,
phase0,
fail_phase, phase0,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail', action=htf.PhaseResult.STOP), error_phase)

Expand All @@ -467,16 +466,14 @@ def test_subtest_previous_fail__fail(self):
action=htf.PhaseResult.STOP,
conditional=phase_branches.PreviousPhases.SUBTEST,
subtest_name=None,
result=phase_executor.PhaseExecutionOutcome(
htf.PhaseResult.STOP),
result=phase_executor.PhaseExecutionOutcome(htf.PhaseResult.STOP),
evaluated_millis=htf_test.VALID_TIMESTAMP),
], test_rec.checkpoints)

@htf_test.yields_phases
def test_subtest_previous_fail__pass(self):
test_rec = yield htf.Test(
phase0,
phase1,
phase0, phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_pass', action=htf.PhaseResult.STOP), phase2)

Expand All @@ -500,11 +497,13 @@ def test_subtest_previous_fail__fail_in_subtest(self):
test_rec = yield htf.Test(
phase0,
htf.Subtest(
'sub', fail_phase, phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_in_subtest', action=htf.PhaseResult.STOP),
),
error_phase)
'sub',
fail_phase,
phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_in_subtest',
action=htf.PhaseResult.STOP),
), error_phase)

self.assertTestFail(test_rec)
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
Expand All @@ -518,8 +517,7 @@ def test_subtest_previous_fail__fail_in_subtest(self):
action=htf.PhaseResult.STOP,
conditional=phase_branches.PreviousPhases.SUBTEST,
subtest_name='sub',
result=phase_executor.PhaseExecutionOutcome(
htf.PhaseResult.STOP),
result=phase_executor.PhaseExecutionOutcome(htf.PhaseResult.STOP),
evaluated_millis=htf_test.VALID_TIMESTAMP),
], test_rec.checkpoints)

Expand All @@ -528,12 +526,13 @@ def test_subtest_previous_fail__fail_out_of_subtest(self):
test_rec = yield htf.Test(
fail_phase,
htf.Subtest(
'sub', phase0,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_out_of_subtest', action=htf.PhaseResult.STOP),
phase1,
),
phase2)
'sub',
phase0,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_out_of_subtest',
action=htf.PhaseResult.STOP),
phase1,
), phase2)

self.assertTestFail(test_rec)
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
Expand All @@ -557,10 +556,12 @@ def test_subtest_previous_fail__pass_in_subtest(self):
test_rec = yield htf.Test(
phase0,
htf.Subtest(
'sub', phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_pass_in_subtest', action=htf.PhaseResult.STOP),
phase2,
'sub',
phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_pass_in_subtest',
action=htf.PhaseResult.STOP),
phase2,
), phase3)

self.assertTestPass(test_rec)
Expand All @@ -585,19 +586,22 @@ def test_subtest_previous_fail_subtest__fail_in_subtest(self):
test_rec = yield htf.Test(
phase0,
htf.Subtest(
'sub', fail_phase, phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_subtest_in_subtest', action=htf.PhaseResult.FAIL_SUBTEST),
skip0,
),
phase2)
'sub',
fail_phase,
phase1,
phase_branches.PhaseFailureCheckpoint.subtest_previous(
'subtest_previous_fail_subtest_in_subtest',
action=htf.PhaseResult.FAIL_SUBTEST),
skip0,
), phase2)

self.assertTestFail(test_rec)
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.PASS, test_rec,
'phase0', 'phase1', 'phase2')
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.FAIL, test_rec,
'fail_phase')
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.SKIP, test_rec, 'skip0')
self.assertPhasesOutcomeByName(test_record.PhaseOutcome.SKIP, test_rec,
'skip0')

self.assertEqual([
test_record.CheckpointRecord(
Expand Down