Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4d90afc
bpo-30917: IDLE: Add config.IdleConf unittest
mlouielu Jul 13, 2017
9fc7670
Add pragma to exclude coverage count
mlouielu Jul 13, 2017
d4dac80
Add unittest
mlouielu Jul 13, 2017
eb32d91
Add gui requires
mlouielu Jul 13, 2017
ddedbc7
Revert "Add pragma to exclude coverage count"
mlouielu Jul 15, 2017
06d8329
Add MacOS specific test correct
mlouielu Jul 15, 2017
f29e0da
Split get_user_config_dir to unix and windows
mlouielu Jul 15, 2017
3f2fdcc
Remove unused import
mlouielu Jul 15, 2017
e445a0e
Destroy tk.root after test cases end
mlouielu Jul 15, 2017
0f1607d
Add skipIf at get_user_cfg_dir test
mlouielu Jul 17, 2017
980a801
Update mock_config to deepcopy make it faster
mlouielu Jul 17, 2017
4ecfb1a
Add comment explain why put extra_help_source_list in same test
mlouielu Jul 18, 2017
d9b3702
Add disable extension to unittest
mlouielu Jul 18, 2017
511b726
Add get_keybinding unittest
mlouielu Jul 18, 2017
49e0534
Add save_user_cfg_files unittest
mlouielu Jul 18, 2017
7fba576
News blurb
terryjreedy Jul 18, 2017
206ae1e
supress warnintg, update coverage
terryjreedy Jul 18, 2017
c850b7f
Update 2017-07-17-23-35-57.bpo-30917.hSiuuO.rst
terryjreedy Jul 18, 2017
ef45060
Addressed terry's comments
mlouielu Jul 18, 2017
7627733
Put extra help source list input data reverse to check it is sorted
mlouielu Jul 18, 2017
2cbb960
Merge branch 'add_idleconf_unittest' of github.com:mlouielu/cpython i…
mlouielu Jul 18, 2017
c94d4b5
Remove sorted in RemoveKeyBindNames
mlouielu Jul 18, 2017
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Lib/idlelib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import sys

from tkinter.font import Font
import idlelib

class InvalidConfigType(Exception): pass
class InvalidConfigSet(Exception): pass
Expand Down Expand Up @@ -216,7 +217,8 @@ def GetUserCfgDir(self):
except OSError:
warn = ('\n Warning: unable to create user config directory\n' +
userDir + '\n Check path and permissions.\n Exiting!\n')
print(warn, file=sys.stderr)
if not idlelib.testing:
print(warn, file=sys.stderr)
raise SystemExit
# TODO continue without userDIr instead of exit
return userDir
Expand Down
17 changes: 13 additions & 4 deletions Lib/idlelib/idle_test/test_config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'''Test idlelib.config.

Coverage: 46% (100% for IdleConfParser, IdleUserConfParser*, ConfigChanges).
* Except is OSError clause in Save method.
Much of IdleConf is exercised by ConfigDialog and test_configdialog,
but it should be tested here.
Coverage: 96% (100% for IdleConfParser, IdleUserConfParser*, ConfigChanges).
* Exception is OSError clause in Save method.
Much of IdleConf is also exercised by ConfigDialog and test_configdialog.
'''
import copy
import sys
Expand All @@ -12,7 +11,9 @@
from test.support import captured_stderr, findfile
import unittest
from unittest import mock
import idlelib
from idlelib import config
from idlelib.idle_test.mock_idle import Func

# Tests should not depend on fortuitous user configurations.
# They must not affect actual user .cfg files.
Expand All @@ -28,9 +29,11 @@

def setUpModule():
idleConf.userCfg = testcfg
idlelib.testing = True

def tearDownModule():
idleConf.userCfg = usercfg
idlelib.testing = False


class IdleConfParserTest(unittest.TestCase):
Expand Down Expand Up @@ -204,6 +207,12 @@ def setUpClass(cls):
conf.userCfg[ctype] = config.IdleUserConfParser(config_path)
conf.LoadCfgFiles()
cls.conf = conf
cls.orig_warn = config._warn
config._warn = Func()

@classmethod
def tearDownClass(cls):
config._warn = cls.orig_warn

def new_config(self, _utest=False):
return config.IdleConf(_utest=_utest)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add tests for idlelib.config.IdleConf.
Increase coverage from 46% to 96%.
Patch by Louie Lu.