Author Saimadhav.Heblikar
Recipients Saimadhav.Heblikar, terry.reedy
Date 2014-06-06.10:52:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1402051948.6.0.158954804013.issue21647@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2014-06-06 10:52:28Saimadhav.Heblikarsetrecipients: + Saimadhav.Heblikar, terry.reedy
2014-06-06 10:52:28Saimadhav.Heblikarsetmessageid: <1402051948.6.0.158954804013.issue21647@psf.upfronthosting.co.za>
2014-06-06 10:52:28Saimadhav.Heblikarlinkissue21647 messages
2014-06-06 10:52:28Saimadhav.Heblikarcreate