File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import absolute_import
2
2
3
3
import sys
4
+ import unittest
4
5
5
6
try :
6
7
from six .moves import tkinter
@@ -35,13 +36,20 @@ def test_moved_module():
35
36
def test_moved_module_fromlist ():
36
37
check_on_input (* MOVED_MODULE_FROMLIST )
37
38
39
+ @unittest .skipIf (sys .version_info [0 ] >= 3 , "Test only runs on Python 2" )
38
40
def test_validate_mapping ():
39
41
for py2_name , six_name in fix_imports_six .FixImportsSix .mapping .items ():
40
42
try :
41
43
__import__ (py2_name )
42
44
__import__ (six_name )
43
- except ImportError as exc :
44
- if 'tkinter' in six_name and tkinter is not None :
45
- raise
46
- elif 'winreg' in six_name and sys .platform .startswith ('win' ):
45
+ except ImportError :
46
+ if 'tkinter' in six_name :
47
+ # Ignore error if tkinter not installed
48
+ if tkinter is not None :
49
+ raise
50
+ elif 'winreg' in six_name :
51
+ # Ignore error if we're not on Windows
52
+ if sys .platform .startswith ('win' ):
53
+ raise
54
+ else :
47
55
raise
You can’t perform that action at this time.
0 commit comments