Refactor commit_cases.py and workflow_test.py
This commit is contained in:
parent
aee87ad495
commit
16faea4e78
@ -174,9 +174,6 @@ def git_repo_case(git_url, expected_commit_message):
|
|||||||
current_directory = ''
|
current_directory = ''
|
||||||
code_diff = ''
|
code_diff = ''
|
||||||
|
|
||||||
def title():
|
|
||||||
return f'commit {git_url}'
|
|
||||||
|
|
||||||
def input_mock(output):
|
def input_mock(output):
|
||||||
nonlocal stdout_result
|
nonlocal stdout_result
|
||||||
nonlocal ui_processed
|
nonlocal ui_processed
|
||||||
@ -239,6 +236,7 @@ def git_repo_case(git_url, expected_commit_message):
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'input': '/commit',
|
'input': '/commit',
|
||||||
|
'title': f'commit {git_url}',
|
||||||
'input_mock': input_mock,
|
'input_mock': input_mock,
|
||||||
'assert': assert_result,
|
'assert': assert_result,
|
||||||
'setup': setup,
|
'setup': setup,
|
||||||
@ -261,10 +259,7 @@ def case1():
|
|||||||
)]
|
)]
|
||||||
current_input_index = 0
|
current_input_index = 0
|
||||||
last_commit_id = None
|
last_commit_id = None
|
||||||
|
|
||||||
def title():
|
|
||||||
return 'commit local repo'
|
|
||||||
|
|
||||||
def input_mock(output):
|
def input_mock(output):
|
||||||
nonlocal current_input_index
|
nonlocal current_input_index
|
||||||
nonlocal input_pattern
|
nonlocal input_pattern
|
||||||
@ -290,6 +285,7 @@ def case1():
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'input': '/commit',
|
'input': '/commit',
|
||||||
|
'title': 'commit local repo',
|
||||||
'input_mock': input_mock,
|
'input_mock': input_mock,
|
||||||
'assert': assert_result,
|
'assert': assert_result,
|
||||||
'setup': setup,
|
'setup': setup,
|
||||||
|
@ -70,7 +70,7 @@ def run_commit_tests():
|
|||||||
exit_code = run_devchat_command(model, case['input'], case['input_mock'])
|
exit_code = run_devchat_command(model, case['input'], case['input_mock'])
|
||||||
case_result = case['assert']()
|
case_result = case['assert']()
|
||||||
case['teardown']()
|
case['teardown']()
|
||||||
case_results.append((case['title'](), case_result and exit_code == 0))
|
case_results.append((case['title'], case_result and exit_code == 0))
|
||||||
else:
|
else:
|
||||||
print('Error: test case setup failed!')
|
print('Error: test case setup failed!')
|
||||||
case_results.append((case['title'](), 'Error: test case setup failed!'))
|
case_results.append((case['title'](), 'Error: test case setup failed!'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user