Show More
@@ -13,6 +13,7 b' import warnings' | |||||
13 | from contextlib import contextmanager |
|
13 | from contextlib import contextmanager | |
14 | from unittest.mock import patch |
|
14 | from unittest.mock import patch | |
15 | from os.path import join, abspath, split |
|
15 | from os.path import join, abspath, split | |
|
16 | from imp import reload | |||
16 |
|
17 | |||
17 | from nose import SkipTest, with_setup |
|
18 | from nose import SkipTest, with_setup | |
18 | import nose.tools as nt |
|
19 | import nose.tools as nt | |
@@ -29,27 +30,19 b' from IPython.utils.tempdir import TemporaryDirectory' | |||||
29 |
|
30 | |||
30 | # Platform-dependent imports |
|
31 | # Platform-dependent imports | |
31 | try: |
|
32 | try: | |
32 |
import winreg as wreg |
|
33 | import winreg as wreg | |
33 | except ImportError: |
|
34 | except ImportError: | |
|
35 | #Fake _winreg module on non-windows platforms | |||
|
36 | import types | |||
|
37 | wr_name = "winreg" | |||
|
38 | sys.modules[wr_name] = types.ModuleType(wr_name) | |||
34 | try: |
|
39 | try: | |
35 |
import |
|
40 | import winreg as wreg | |
36 | except ImportError: |
|
41 | except ImportError: | |
37 | #Fake _winreg module on none windows platforms |
|
42 | import _winreg as wreg | |
38 | import types |
|
|||
39 | wr_name = "winreg" if py3compat.PY3 else "_winreg" |
|
|||
40 | sys.modules[wr_name] = types.ModuleType(wr_name) |
|
|||
41 | try: |
|
|||
42 | import winreg as wreg |
|
|||
43 | except ImportError: |
|
|||
44 | import _winreg as wreg |
|
|||
45 | #Add entries that needs to be stubbed by the testing code |
|
43 | #Add entries that needs to be stubbed by the testing code | |
46 | (wreg.OpenKey, wreg.QueryValueEx,) = (None, None) |
|
44 | (wreg.OpenKey, wreg.QueryValueEx,) = (None, None) | |
47 |
|
45 | |||
48 | try: |
|
|||
49 | reload |
|
|||
50 | except NameError: # Python 3 |
|
|||
51 | from imp import reload |
|
|||
52 |
|
||||
53 | #----------------------------------------------------------------------------- |
|
46 | #----------------------------------------------------------------------------- | |
54 | # Globals |
|
47 | # Globals | |
55 | #----------------------------------------------------------------------------- |
|
48 | #----------------------------------------------------------------------------- |
General Comments 0
You need to be logged in to leave comments.
Login now