in batch mode, the dialog allways return FAIL, except if auto_result is defined (validation only).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -54,16 +54,26 @@ class TestItemChoicesDialog(TestItemDialogBase):
|
|||||||
self._print_choices(choices)
|
self._print_choices(choices)
|
||||||
if _is_interactive():
|
if _is_interactive():
|
||||||
ans = input("Accept all? (y/n) [default: y]: ").strip().lower()
|
ans = input("Accept all? (y/n) [default: y]: ").strip().lower()
|
||||||
|
if ans in ('n', 'no'):
|
||||||
|
tm.delgd("cs_" + self._name)
|
||||||
|
self.result.set(TestValue.FAILURE, "Cancelled")
|
||||||
|
else:
|
||||||
|
val = self._all_checked(choices)
|
||||||
|
self.result.value = val
|
||||||
|
tm.setgd("cs_" + self._name, val)
|
||||||
|
self.result.set(TestValue.SUCCESS, str(val))
|
||||||
else:
|
else:
|
||||||
ans = ''
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
if ans in ('n', 'no'):
|
if ar is None:
|
||||||
tm.delgd("cs_" + self._name)
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
self.result.set(TestValue.FAILURE, "Cancelled")
|
elif ar == 'cancel':
|
||||||
else:
|
tm.delgd("cs_" + self._name)
|
||||||
val = self._all_checked(choices)
|
self.result.set(TestValue.FAILURE, "Cancelled")
|
||||||
self.result.value = val
|
else:
|
||||||
tm.setgd("cs_" + self._name, val)
|
val = self._all_checked(choices)
|
||||||
self.result.set(TestValue.SUCCESS, str(val))
|
self.result.value = val
|
||||||
|
tm.setgd("cs_" + self._name, val)
|
||||||
|
self.result.set(TestValue.SUCCESS, str(val))
|
||||||
return
|
return
|
||||||
from interpreter.test_items.dialog_choices_files import choices_dialog
|
from interpreter.test_items.dialog_choices_files import choices_dialog
|
||||||
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
|||||||
@@ -34,12 +34,15 @@ class TestItemImageDialog(TestItemDialogBase):
|
|||||||
if _is_text_mode():
|
if _is_text_mode():
|
||||||
if _is_interactive():
|
if _is_interactive():
|
||||||
ans = input("Accept? (y/n) [default: y]: ").strip().lower()
|
ans = input("Accept? (y/n) [default: y]: ").strip().lower()
|
||||||
|
self.result.set(TestValue.FAILURE if ans in ('n', 'no') else TestValue.SUCCESS)
|
||||||
else:
|
else:
|
||||||
ans = ''
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
if ans in ('n', 'no'):
|
if ar is None:
|
||||||
self.result.set(TestValue.FAILURE)
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
else:
|
elif ar == 'cancel':
|
||||||
self.result.set(TestValue.SUCCESS)
|
self.result.set(TestValue.FAILURE)
|
||||||
|
else:
|
||||||
|
self.result.set(TestValue.SUCCESS)
|
||||||
return
|
return
|
||||||
from interpreter.test_items.dialog_image_files import dialog_image
|
from interpreter.test_items.dialog_image_files import dialog_image
|
||||||
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
|||||||
@@ -28,7 +28,13 @@ class TestItemMsgDialog(TestItemDialogBase):
|
|||||||
if _is_text_mode():
|
if _is_text_mode():
|
||||||
if _is_interactive():
|
if _is_interactive():
|
||||||
input("Press Enter to continue...")
|
input("Press Enter to continue...")
|
||||||
self.result.set(TestValue.SUCCESS)
|
self.result.set(TestValue.SUCCESS)
|
||||||
|
else:
|
||||||
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
if ar is not None:
|
||||||
|
self.result.set(TestValue.SUCCESS)
|
||||||
|
else:
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
return
|
return
|
||||||
from interpreter.test_items.dialog_msg_files import msg_dialog
|
from interpreter.test_items.dialog_msg_files import msg_dialog
|
||||||
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
|||||||
@@ -22,15 +22,25 @@ class TestItemNoteDialog(TestItemDialogBase):
|
|||||||
q = self._prms.expanse(self._question)
|
q = self._prms.expanse(self._question)
|
||||||
print("Question:\n" + q)
|
print("Question:\n" + q)
|
||||||
if _is_text_mode():
|
if _is_text_mode():
|
||||||
lines = []
|
|
||||||
if _is_interactive():
|
if _is_interactive():
|
||||||
print("Enter your note (type '.' on a new line to finish, empty line to cancel):")
|
print("Enter your note (type '.' on a new line to finish, empty line to cancel):")
|
||||||
|
lines = []
|
||||||
while True:
|
while True:
|
||||||
line = input()
|
line = input()
|
||||||
if line == '.':
|
if line == '.':
|
||||||
break
|
break
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
val = '\n'.join(lines)
|
val = '\n'.join(lines)
|
||||||
|
else:
|
||||||
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
av = self._prms.expanse(self._auto_value) if self._auto_value is not None else None
|
||||||
|
if ar is None:
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
|
return
|
||||||
|
if ar == 'cancel':
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog cancelled')
|
||||||
|
return
|
||||||
|
val = av if av is not None else ''
|
||||||
tm.setgd(self.name(), val)
|
tm.setgd(self.name(), val)
|
||||||
print("\n" + ("-" * 80) + "\n")
|
print("\n" + ("-" * 80) + "\n")
|
||||||
print("- Test note\n")
|
print("- Test note\n")
|
||||||
|
|||||||
@@ -25,14 +25,22 @@ class TestItemQuestionDialog(TestItemDialogBase):
|
|||||||
if _is_text_mode():
|
if _is_text_mode():
|
||||||
if _is_interactive():
|
if _is_interactive():
|
||||||
ans = input("Answer yes (y) or no (n) [default: y]: ").strip().lower()
|
ans = input("Answer yes (y) or no (n) [default: y]: ").strip().lower()
|
||||||
|
if ans in ('n', 'no'):
|
||||||
|
self.result.set(TestValue.FAILURE)
|
||||||
|
print('Answer: NO\n')
|
||||||
|
else:
|
||||||
|
self.result.set(TestValue.SUCCESS)
|
||||||
|
print('Answer: YES\n')
|
||||||
else:
|
else:
|
||||||
ans = ''
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
if ans in ('n', 'no'):
|
if ar is None:
|
||||||
self.result.set(TestValue.FAILURE)
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
print('Answer: NO\n')
|
elif ar in ('no', 'cancel'):
|
||||||
else:
|
self.result.set(TestValue.FAILURE)
|
||||||
self.result.set(TestValue.SUCCESS)
|
print('Answer: NO\n')
|
||||||
print('Answer: YES\n')
|
else:
|
||||||
|
self.result.set(TestValue.SUCCESS)
|
||||||
|
print('Answer: YES\n')
|
||||||
return
|
return
|
||||||
from interpreter.test_items.dialog_question_files import question_dialog
|
from interpreter.test_items.dialog_question_files import question_dialog
|
||||||
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
|||||||
@@ -35,7 +35,15 @@ class TestItemTestedRefsDialog(TestItemDialogBase):
|
|||||||
ref, rev, serial = parts[0], parts[1], parts[2]
|
ref, rev, serial = parts[0], parts[1], parts[2]
|
||||||
result_rows.append(f"{ref}/{rev}/{serial}")
|
result_rows.append(f"{ref}/{rev}/{serial}")
|
||||||
val = ','.join(result_rows)
|
val = ','.join(result_rows)
|
||||||
result = [val, True]
|
if _is_interactive():
|
||||||
|
succ = True
|
||||||
|
else:
|
||||||
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
if ar is None:
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
|
return
|
||||||
|
succ = ar != 'cancel'
|
||||||
|
result = [val, succ]
|
||||||
else:
|
else:
|
||||||
from interpreter.test_items.tested_references_files import tested_refs_dialog
|
from interpreter.test_items.tested_references_files import tested_refs_dialog
|
||||||
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
|||||||
@@ -31,7 +31,17 @@ class TestItemValueDialog(TestItemDialogBase):
|
|||||||
prompt = f"Enter value [{d}]: " if d else "Enter value: "
|
prompt = f"Enter value [{d}]: " if d else "Enter value: "
|
||||||
ans = input(prompt).strip()
|
ans = input(prompt).strip()
|
||||||
else:
|
else:
|
||||||
ans = ''
|
ar = self._prms.expanse(self._auto_result) if self._auto_result is not None else None
|
||||||
|
av = self._prms.expanse(self._auto_value) if self._auto_value is not None else None
|
||||||
|
if ar is None:
|
||||||
|
print("Answer: \nDialog not supported in batch mode")
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog not supported in batch mode')
|
||||||
|
return
|
||||||
|
if ar == 'cancel':
|
||||||
|
print("Answer: \nDialog cancelled")
|
||||||
|
self.result.set(TestValue.FAILURE, 'Dialog cancelled')
|
||||||
|
return
|
||||||
|
ans = av if av is not None else ''
|
||||||
val = ans if ans else d
|
val = ans if ans else d
|
||||||
tm.setgd(self.name(), val)
|
tm.setgd(self.name(), val)
|
||||||
print("Answer: " + str(val))
|
print("Answer: " + str(val))
|
||||||
|
|||||||
Reference in New Issue
Block a user