Skip to content

Commit e843bb7

Browse files
committed
implement exception handling for setUp()
Checklist: - Invoke tearDown even if the test method fails - Run multiple tests - Report failed tests ✅ - Catch and report setUp errors ✅
1 parent 8649b6a commit e843bb7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/test_case.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ def setUp(self) -> None:
1212
def run(self) -> None:
1313
result = TestResult()
1414
result.testStarted()
15-
self.setUp()
15+
16+
try:
17+
self.setUp()
18+
except:
19+
result.testFailed()
20+
return result
1621

1722
try:
1823
method = getattr(self, self.name)

0 commit comments

Comments
 (0)