Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f776eb0f
Commit
f776eb0f
authored
Jul 19, 2017
by
Louie Lu
Committed by
terryjreedy
Jul 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-30917: IDLE: Add config.IdleConf unittests (#2691)
Patch by Louie Lu.
parent
5feda33a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
454 additions
and
18 deletions
+454
-18
Lib/idlelib/config.py
Lib/idlelib/config.py
+8
-14
Lib/idlelib/idle_test/test_config.py
Lib/idlelib/idle_test/test_config.py
+443
-4
Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst
...NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst
+3
-0
No files found.
Lib/idlelib/config.py
View file @
f776eb0f
...
...
@@ -30,6 +30,7 @@ import os
import
sys
from
tkinter.font
import
Font
import
idlelib
class
InvalidConfigType
(
Exception
):
pass
class
InvalidConfigSet
(
Exception
):
pass
...
...
@@ -159,14 +160,15 @@ class IdleConf:
for config_type in self.config_types:
(user home dir)/.idlerc/config-{config-type}.cfg
"""
def
__init__
(
self
):
def
__init__
(
self
,
_utest
=
False
):
self
.
config_types
=
(
'main'
,
'highlight'
,
'keys'
,
'extensions'
)
self
.
defaultCfg
=
{}
self
.
userCfg
=
{}
self
.
cfg
=
{}
# TODO use to select userCfg vs defaultCfg
self
.
CreateConfigHandlers
()
self
.
LoadCfgFiles
()
if
not
_utest
:
self
.
CreateConfigHandlers
()
self
.
LoadCfgFiles
()
def
CreateConfigHandlers
(
self
):
"Populate default and user config parser dictionaries."
...
...
@@ -215,7 +217,8 @@ class IdleConf:
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
...
...
@@ -463,16 +466,7 @@ class IdleConf:
def
RemoveKeyBindNames
(
self
,
extnNameList
):
"Return extnNameList with keybinding section names removed."
# TODO Easier to return filtered copy with list comp
names
=
extnNameList
kbNameIndicies
=
[]
for
name
in
names
:
if
name
.
endswith
((
'_bindings'
,
'_cfgBindings'
)):
kbNameIndicies
.
append
(
names
.
index
(
name
))
kbNameIndicies
.
sort
(
reverse
=
True
)
for
index
in
kbNameIndicies
:
#delete each keybinding section name
del
(
names
[
index
])
return
names
return
[
n
for
n
in
extnNameList
if
not
n
.
endswith
((
'_bindings'
,
'_cfgBindings'
))]
def
GetExtnNameForEvent
(
self
,
virtualEvent
):
"""Return the name of the extension binding virtualEvent, or None.
...
...
Lib/idlelib/idle_test/test_config.py
View file @
f776eb0f
This diff is collapsed.
Click to expand it.
Misc/NEWS.d/next/IDLE/2017-07-17-23-35-57.bpo-30917.hSiuuO.rst
0 → 100644
View file @
f776eb0f
Add tests for idlelib.config.IdleConf.
Increase coverage from 46% to 96%.
Patch by Louie Lu.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment