1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-02-22 21:08:51 +00:00

StateDetection: Moved check for missing phase definition earlier.

Now checks to see if a phase is correctly defined before image matching
so that it is only performed if required.
This commit is contained in:
Marc Bonnici 2017-01-20 09:29:49 +00:00
parent 54bffb45ab
commit b89d9bbc4b

View File

@ -136,9 +136,6 @@ def verify_state(screenshot_file, state_defs_path, workload_phase):
with open(statedefs_file) as fh: with open(statedefs_file) as fh:
state_definitions = yaml.load(fh) state_definitions = yaml.load(fh)
# run a match on the screenshot
matched_state = match_state(screenshot_file, state_defs_path, state_definitions)
# find what the expected state is for the given workload phase # find what the expected state is for the given workload phase
expected_state = None expected_state = None
for phase in state_definitions["workload_phases"]: for phase in state_definitions["workload_phases"]:
@ -148,4 +145,7 @@ def verify_state(screenshot_file, state_defs_path, workload_phase):
if expected_state is None: if expected_state is None:
raise StateDefinitionError("Phase not defined") raise StateDefinitionError("Phase not defined")
# run a match on the screenshot
matched_state = match_state(screenshot_file, state_defs_path, state_definitions)
return expected_state == matched_state return expected_state == matched_state