[New-bugs-announce] [issue31004] IDLE, configdialog: Factor out FontTab class from ConfigDialog

Terry J. Reedy report at bugs.python.org
Mon Jul 24 04:03:45 EDT 2017


New submission from Terry J. Reedy:

I want to follow the safe way to refactor (from a blog post), rather than the hacker way of refactoring 'in place'.
Step 0: Test code to be refactored.  Finished in 30993.

Step 1: Copy code to be refactored and modify as needed to isolate it from the working original.  For configdialog, add 'class FontPage' below ConfigDialog and copy font/tab methods, now collected together, below that.  For the test, copy class FontTest as FontPageTest and IndentTest as IndentOptionTest. The copies should pass as they will still be testing the original code.  Commit.

Step 2: Modify code as desired.  Modify test copy to test code copy.  For FontPage, this will require new tracer manager (#30853) to attach (activate) callbacks so tests will pass.  Commit.

Step 3: Switch from using original code to using modified code.  For this issue, calling FontPage instead of create_page_font_tab may be enough.  Skip original test; modify new test as needed to pass.  Commit.

Step 4: Once we are sure that we do not need the original code that has been replaced, delete it.  Rerun tests. Commit.

The separate commits will make review easier.  Create or update PRs as desired.

----------
assignee: terry.reedy
components: IDLE
messages: 298933
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE, configdialog: Factor out FontTab class from ConfigDialog
type: enhancement
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31004>
_______________________________________


More information about the New-bugs-announce mailing list