Saimadhav Heblikar added the comment:

Perhaps, we can move GUI/non GUI code into blocks. I will take Text as example. 

from test import support
if support._is_gui_available():
   from tkinter import Text
else:
   from idlelib.idle_test.mock_tk import Text
.
.
.
if not support._is_gui_available():
    parts of test which can be run keeping in mind mock.Text's      limitations.
else:
    everything, using tkinter.Text



Only drawback is _is_gui_available is not documented publicly. Also, we'd will 
have lot of if...else blocks all over the place. Avoiding code duplication will 
be tricky.
If nothing else, the if...else block can be used at the import level only.

----------

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

Reply via email to