Skip to content

Commit

Permalink
implement exception handling for setUp()
Browse files Browse the repository at this point in the history
Checklist:
- Invoke tearDown even if the test method fails
- Run multiple tests
- Report failed tests ✅
- Catch and report setUp errors ✅
  • Loading branch information
kaiosilveira committed Mar 18, 2023
1 parent f15c647 commit ca7f326
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ def setUp(self) -> None:
def run(self) -> None:
result = TestResult()
result.testStarted()
self.setUp()

try:
self.setUp()
except:
result.testFailed()
return result

try:
method = getattr(self, self.name)
Expand Down

0 comments on commit ca7f326

Please sign in to comment.