Erlend E. Aasland <erlend.aasl...@innova.no> added the comment:
The current code duplication has several negative impacts, IMO: - Readability Currently the ThreadTests class spans 173 lines. Refactored, it spans 51 lines (should fit in a screenful), making it easy to see what's actually being tested. Currently, the tests differ by only one line; the remaining 15 lines are boilerplate code. That's 15 lines of boilerplate code per test method. - Maintainability Currently, if the boilerplate code needs tuning (or bugfixing), we must adjust it in _all_ the test methods. For example, adding the @threading_helper.reap_threads decorator to every single test. After refactoring, the boilerplate code is refactored out; adding the reap threads decorator needs only be done in one place; modifying the boilerplate code needs only be done in one place. - Fewer lines of code; improved maintainability diff stat: 1 file changed, 37 insertions(+), 140 deletions(-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44430> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com