diff -r 9c8be3b89964 Lib/idlelib/colorizer.py --- a/Lib/idlelib/colorizer.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/colorizer.py Fri Jun 03 03:52:37 2016 -0400 @@ -2,7 +2,6 @@ import re import keyword import builtins -from tkinter import TkVersion from idlelib.delegator import Delegator from idlelib.config import idleConf @@ -49,11 +48,8 @@ insertbackground=cursor_color, selectforeground=select_colors['foreground'], selectbackground=select_colors['background'], - ) - if TkVersion >= 8.5: - text.config( - inactiveselectbackground=select_colors['background']) - + inactiveselectbackground=select_colors['background'], + ) class ColorDelegator(Delegator): @@ -277,5 +273,8 @@ p.insertfilter(d) if __name__ == "__main__": + import unittest + unittest.main('idlelib.idle_test.test_colorizer', + verbosity=2, exit=False) from idlelib.idle_test.htest import run run(_color_delegator) diff -r 9c8be3b89964 Lib/idlelib/config.py --- a/Lib/idlelib/config.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/config.py Fri Jun 03 03:52:37 2016 -0400 @@ -22,7 +22,6 @@ import sys from configparser import ConfigParser -from tkinter import TkVersion from tkinter.font import Font, nametofont class InvalidConfigType(Exception): pass @@ -713,16 +712,13 @@ bold = self.GetOption(configType, section, 'font-bold', default=0, type='bool') if (family == 'TkFixedFont'): - if TkVersion < 8.5: - family = 'Courier' - else: - f = Font(name='TkFixedFont', exists=True, root=root) - actualFont = Font.actual(f) - family = actualFont['family'] - size = actualFont['size'] - if size <= 0: - size = 10 # if font in pixels, ignore actual size - bold = actualFont['weight']=='bold' + f = Font(name='TkFixedFont', exists=True, root=root) + actualFont = Font.actual(f) + family = actualFont['family'] + size = actualFont['size'] + if size <= 0: + size = 10 # if font in pixels, ignore actual size + bold = actualFont['weight']=='bold' return (family, size, 'bold' if bold else 'normal') def LoadCfgFiles(self): diff -r 9c8be3b89964 Lib/idlelib/editor.py --- a/Lib/idlelib/editor.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/editor.py Fri Jun 03 03:52:37 2016 -0400 @@ -110,13 +110,10 @@ 'wrap': 'none', 'highlightthickness': 0, 'width': self.width, - 'height': idleConf.GetOption('main', 'EditorWindow', - 'height', type='int')} - if TkVersion >= 8.5: - # Starting with tk 8.5 we have to set the new tabstyle option - # to 'wordprocessor' to achieve the same display of tabs as in - # older tk versions. - text_options['tabstyle'] = 'wordprocessor' + 'tabstyle': 'wordprocessor', # new in 8.5 + 'height': idleConf.GetOption( + 'main', 'EditorWindow', 'height', type='int'), + } self.text = text = MultiCallCreator(Text)(text_frame, **text_options) self.top.focused_widget = self.text diff -r 9c8be3b89964 Lib/idlelib/idle_test/test_colorizer.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/idlelib/idle_test/test_colorizer.py Fri Jun 03 03:52:37 2016 -0400 @@ -0,0 +1,52 @@ +'''Test idlelib/colorizer.py + +Perform minimal sanity checks that some things run. +''' +from idlelib import colorizer # always test import +from test.support import requires +from tkinter import Tk, Text # needed for testing, not by module +import unittest + + +class FunctionTest(unittest.TestCase): + def test_any(self): + self.assertTrue(colorizer.any('test', ('a', 'b'))) + def test_make_pat(self): + self.assertTrue(colorizer.make_pat()) + + +class ColorConfigTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + cls.text = Text(cls.root) + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.text + del cls.root + + def test_colorizer(self): + colorizer.color_config(self.text) + +class ColorDelegatorTest(unittest.TestCase): + + @classmethod + def setUpClass(cls): + requires('gui') + cls.root = Tk() + + @classmethod + def tearDownClass(cls): + cls.root.destroy() + del cls.root + + def test_colorizer(self): + colorizer.ColorDelegator() + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff -r 9c8be3b89964 Lib/idlelib/idle_test/test_config.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/idlelib/idle_test/test_config.py Fri Jun 03 03:52:37 2016 -0400 @@ -0,0 +1,17 @@ +'''Test idlelib/config.py + +Perform minimal sanity checks that some things run. +''' +from idlelib import config # always test import +import unittest + +##class ConfigTest(unittest.TestCase): +## def test_config(self): pass + +# Do buildbots have $HOME? Add idlelib/.idlerc, empty or with test data. +# Add userDir parameter to IdleConf.GetUserCfgDir + +# See end of config for current dump-all human test. + +if __name__ == '__main__': + unittest.main(verbosity=2) diff -r 9c8be3b89964 Lib/idlelib/idle_test/test_configdialog.py --- a/Lib/idlelib/idle_test/test_configdialog.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/idle_test/test_configdialog.py Fri Jun 03 03:52:37 2016 -0400 @@ -1,12 +1,13 @@ -'''Unittests for idlelib/config.py +'''Test idlelib/configdialog.py -Coverage: 46% just by creating dialog. The other half is change code. - +Coverage: 46% just by creating dialog. +The other half is code for changing options. ''' +from idlelib.configdialog import ConfigDialog # always test import +from test.support import requires +requires('gui') +from tkinter import Tk import unittest -from test.support import requires -from tkinter import Tk -from idlelib.configdialog import ConfigDialog from idlelib.macosx import _initializeTkVariantTests @@ -14,7 +15,6 @@ @classmethod def setUpClass(cls): - requires('gui') cls.root = Tk() _initializeTkVariantTests(cls.root) @@ -26,7 +26,7 @@ def test_dialog(self): d=ConfigDialog(self.root, 'Test', _utest=True) d.remove_var_callbacks() - d.destroy() + #d.destroy() if __name__ == '__main__': diff -r 9c8be3b89964 Lib/idlelib/idle_test/test_macosx.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lib/idlelib/idle_test/test_macosx.py Fri Jun 03 03:52:37 2016 -0400 @@ -0,0 +1,16 @@ +'''Test idlelib/macosx.py + +Perform minimal sanity checks that some things run. +''' +from idlelib import macosx # always test import +import unittest + +class NonMacTest(unittest.TestCase): + "Test that calls made on non-macs have correct returns." + + +class MacosxTest(unittest.TestCase): pass + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff -r 9c8be3b89964 Lib/idlelib/macosx.py --- a/Lib/idlelib/macosx.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/macosx.py Fri Jun 03 03:52:37 2016 -0400 @@ -202,12 +202,6 @@ ('About IDLE', '<>'), None, ])) - tkversion = root.tk.eval('info patchlevel') - if tuple(map(int, tkversion.split('.'))) < (8, 4, 14): - # for earlier AquaTk versions, supply a Preferences menu item - mainmenu.menudefs[0][1].append( - ('_Preferences....', '<>'), - ) if isCocoaTk(): # replace default About dialog with About IDLE one root.createcommand('tkAboutDialog', about_dialog) diff -r 9c8be3b89964 Lib/idlelib/pyshell.py --- a/Lib/idlelib/pyshell.py Fri Jun 03 00:57:26 2016 +0000 +++ b/Lib/idlelib/pyshell.py Fri Jun 03 03:52:37 2016 -0400 @@ -1,5 +1,20 @@ #! /usr/bin/env python3 +try: + from tkinter import * +except ImportError: + print("** IDLE can't import Tkinter.\n" + "Your Python may not be configured for Tk. **", file=sys.__stderr__) + sys.exit(1) +import tkinter.messagebox as tkMessageBox +if TkVersion < 8.5: + root = Tk() + root.withdraw() + tkMessageBox.showerror("Idle Cannot Start", + "Idle requires tcl/tk 8.5+, not $s." % TkVersion, + parent=root) + sys.exit(1) + import getopt import os import os.path @@ -16,14 +31,6 @@ from code import InteractiveInterpreter from platform import python_version, system -try: - from tkinter import * -except ImportError: - print("** IDLE can't import Tkinter.\n" - "Your Python may not be configured for Tk. **", file=sys.__stderr__) - sys.exit(1) -import tkinter.messagebox as tkMessageBox - from idlelib.editor import EditorWindow, fixwordbreaks from idlelib.filelist import FileList from idlelib.colorizer import ColorDelegator @@ -1536,7 +1543,7 @@ if system() == 'Windows': iconfile = os.path.join(icondir, 'idle.ico') root.wm_iconbitmap(default=iconfile) - elif TkVersion >= 8.5: + else: ext = '.png' if TkVersion >= 8.6 else '.gif' iconfiles = [os.path.join(icondir, 'idle_%d%s' % (size, ext)) for size in (16, 32, 48)]