Rewrite tearDown methods to cleanups (addCleanup) #534
Labels
good to start
Start form this tasks if you're new in the framework
Infrastructure
The framework reworking and extensions
Milestone
Problem
tearDown assumes that code will be called only if setUp is successful (see https://github.com/python/cpython/blob/main/Lib/unittest/case.py#L639). This is not our case in most (or all) cases where tearDown is used. This problem may leads to many seemingly unrelated test failures as well as cascade failures in pipline runs.
Solution
Use cleanups instead everywhere code should be called regardless of setUp fail (on any stage). Cleanups called separately, so exeptions in it won't break another cleanups. Pay attention to cleanup order of execution though.
Why this issue probably should be prioritized
This fix easy to do and probably it will make tests way more stable.
The text was updated successfully, but these errors were encountered: