Skip to content

Commit edde19d

Browse files
committed
Merge branch 'feature/validate-exceptions'
2 parents 03712e8 + 7cb2d48 commit edde19d

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
api-key: ${{ secrets.GOOGLE_API_KEY }}
4343
readme-path: tests/sample_readme.md
4444
explanation-in: Korean
45+
fail-expected: True
4546
timeout-minutes: 5
4647

4748
- name: Output the outputs of the integration test of the action

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
* MECE principle in comment generation
1111
* if failed, assert the error message
12+
* fail-expected argument to fail the test if the expected fail count not correct
1213

1314

1415
### Changed

entrypoint.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ def main() -> None:
3333

3434
explanation_in = os.environ['INPUT_EXPLANATION-IN']
3535

36+
b_fail_expected = ('true' == os.getenv('INPUT_FAIL-EXPECTED', 'false').lower())
37+
3638
n_failed, feedback = ai_tutor.gemini_qna(
3739
report_files,
3840
student_files,
@@ -48,7 +50,12 @@ def main() -> None:
4850
out_string = f'feedback<<EOF\n{feedback}\nEOF'
4951
logging.info(f"Writing to GITHUB_OUTPUT: {f.write(out_string)} characters")
5052

51-
assert n_failed == 0, f'{n_failed} failed tests'
53+
if not b_fail_expected:
54+
assert n_failed == 0, f'{n_failed} failed tests'
55+
elif b_fail_expected:
56+
assert n_failed > 0, 'No failed tests'
57+
else:
58+
raise NotImplementedError('Unexpected value for INPUT_FAIL-EXPECTED')
5259

5360

5461
def get_path_tuple(report_files_str:str) -> Tuple[pathlib.Path]:

0 commit comments

Comments
 (0)