Commit c37a9e3e by JonahStanley

Refactored problem_setup to use retry_on_exception

parent b4036c66
...@@ -313,18 +313,13 @@ def assert_checked(problem_type, choices): ...@@ -313,18 +313,13 @@ def assert_checked(problem_type, choices):
all_choices = ['choice_0', 'choice_1', 'choice_2', 'choice_3'] all_choices = ['choice_0', 'choice_1', 'choice_2', 'choice_3']
for this_choice in all_choices: for this_choice in all_choices:
attempt = 0 def check_problem():
while attempt < 5: element = world.css_find(inputfield(problem_type, choice=this_choice))
try: if this_choice in choices:
element = world.css_find(inputfield(problem_type, choice=this_choice)) assert element.checked
if this_choice in choices: else:
assert element.checked assert not element.checked
else: world.retry_on_exception(check_problem)
assert not element.checked
break
except:
attempt += 1
assert_true(attempt < 5, "Could not access {}".format(element))
def assert_textfield(problem_type, expected_text, input_num=1): def assert_textfield(problem_type, expected_text, input_num=1):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment