Terry J. Reedy added the comment:

For tests that use a Text widget, I want the first version to be a gui test 
using tkinter.Text. This removes mock Text as an issue in writing the tests. I 
will not commit without running the test 'live' at least once.

Once the file (or at least a TestCase) is complete, we can then consider 
replacing the real Text with the mock. The gui code is commented out, rather 
than deleted, in case there is ever a need to switch back. See 
test_searchengine.py (#18489), where this was done,  (Even partial conversions 
are worthwhile if complete conversion is not possible.) Did I forget to say 
this in idle_test/README.txt? (I know I forget to mention this directly before 
now, Sorry ;-).

Some modules import tkinter and instantiate widgets either upon import or 
during testing, (This is different from taking a widget instance as an argument 
in .__init__.) If so  a gui-free test requires that the module be 
monkey-patched with mocks. For SearchEngine, the only widgets are XyzVars and 
TkMessageBox, for which we do have mocks. AutoExpand does not import tkinter, 
so it is fine as is.

In your patch, comment out "from idlelib.idle_test.mock_tk import Text" and add 
the needed gui code. See the commented out code in 
test_searchengine.

----------
stage: patch review -> needs patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18292>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to