Show More
@@ -146,7 +146,7 b' class Tracer(object):' | |||
|
146 | 146 | # at least raise that limit to 80 chars, which should be enough for |
|
147 | 147 | # most interactive uses. |
|
148 | 148 | try: |
|
149 | from repr import aRepr | |
|
149 | from reprlib import aRepr | |
|
150 | 150 | aRepr.maxstring = 80 |
|
151 | 151 | except: |
|
152 | 152 | # This is only a user-facing convenience, so any error we encounter |
@@ -331,7 +331,7 b' class Pdb(OldPdb):' | |||
|
331 | 331 | # vds: << |
|
332 | 332 | |
|
333 | 333 | def format_stack_entry(self, frame_lineno, lprefix=': ', context = 3): |
|
334 | import repr | |
|
334 | import reprlib | |
|
335 | 335 | |
|
336 | 336 | ret = [] |
|
337 | 337 | |
@@ -349,7 +349,7 b' class Pdb(OldPdb):' | |||
|
349 | 349 | if '__return__' in frame.f_locals: |
|
350 | 350 | rv = frame.f_locals['__return__'] |
|
351 | 351 | #return_value += '->' |
|
352 | return_value += repr.repr(rv) + '\n' | |
|
352 | return_value += reprlib.repr(rv) + '\n' | |
|
353 | 353 | ret.append(return_value) |
|
354 | 354 | |
|
355 | 355 | #s = filename + '(' + `lineno` + ')' |
@@ -364,7 +364,7 b' class Pdb(OldPdb):' | |||
|
364 | 364 | call = '' |
|
365 | 365 | if func != '?': |
|
366 | 366 | if '__args__' in frame.f_locals: |
|
367 | args = repr.repr(frame.f_locals['__args__']) | |
|
367 | args = reprlib.repr(frame.f_locals['__args__']) | |
|
368 | 368 | else: |
|
369 | 369 | args = '()' |
|
370 | 370 | call = tpl_call % (func, args) |
@@ -170,7 +170,10 b' class ExtensionManager(Configurable):' | |||
|
170 | 170 | copy = copyfile |
|
171 | 171 | else: |
|
172 | 172 | from urllib import urlretrieve # Deferred imports |
|
173 | from urlparse import urlparse | |
|
173 | try: | |
|
174 | from urllib.parse import urlparse # Py3 | |
|
175 | except ImportError: | |
|
176 | from urlparse import urlparse | |
|
174 | 177 | src_filename = urlparse(url).path.split('/')[-1] |
|
175 | 178 | copy = urlretrieve |
|
176 | 179 |
@@ -28,7 +28,7 b' import abc' | |||
|
28 | 28 | import sys |
|
29 | 29 | import warnings |
|
30 | 30 | # We must use StringIO, as cStringIO doesn't handle unicode properly. |
|
31 |
from |
|
|
31 | from io import StringIO | |
|
32 | 32 | |
|
33 | 33 | # Our own imports |
|
34 | 34 | from IPython.config.configurable import Configurable |
@@ -1,7 +1,7 b'' | |||
|
1 | 1 | import abc |
|
2 | 2 | import functools |
|
3 | 3 | import re |
|
4 |
from |
|
|
4 | from io import StringIO | |
|
5 | 5 | |
|
6 | 6 | from IPython.core.splitinput import LineInfo |
|
7 | 7 | from IPython.utils import tokenize2 |
@@ -20,7 +20,7 b' import bdb' | |||
|
20 | 20 | import os |
|
21 | 21 | import sys |
|
22 | 22 | import time |
|
23 |
from |
|
|
23 | from io import StringIO | |
|
24 | 24 | |
|
25 | 25 | # cProfile was added in Python2.5 |
|
26 | 26 | try: |
@@ -58,7 +58,7 b' class PdbTestInput(object):' | |||
|
58 | 58 | #----------------------------------------------------------------------------- |
|
59 | 59 | |
|
60 | 60 | def test_longer_repr(): |
|
61 | from repr import repr as trepr | |
|
61 | from reprlib import repr as trepr | |
|
62 | 62 | |
|
63 | 63 | a = '1234567890'* 7 |
|
64 | 64 | ar = "'1234567890123456789012345678901234567890123456789012345678901234567890'" |
@@ -28,7 +28,7 b' import sys' | |||
|
28 | 28 | import tempfile |
|
29 | 29 | import unittest |
|
30 | 30 | from os.path import join |
|
31 |
from |
|
|
31 | from io import StringIO | |
|
32 | 32 | |
|
33 | 33 | # third-party |
|
34 | 34 | import nose.tools as nt |
@@ -155,7 +155,7 b' class InteractiveShellTestCase(unittest.TestCase):' | |||
|
155 | 155 | " list.__init__(self,x)")) |
|
156 | 156 | ip.run_cell("w=Mylist([1,2,3])") |
|
157 | 157 | |
|
158 |
from |
|
|
158 | from pickle import dumps | |
|
159 | 159 | |
|
160 | 160 | # We need to swap in our main module - this is only necessary |
|
161 | 161 | # inside the test framework, because IPython puts the interactive module |
@@ -12,7 +12,7 b' from __future__ import absolute_import' | |||
|
12 | 12 | import io |
|
13 | 13 | import os |
|
14 | 14 | import sys |
|
15 |
from |
|
|
15 | from io import StringIO | |
|
16 | 16 | from unittest import TestCase |
|
17 | 17 | |
|
18 | 18 | try: |
@@ -9,7 +9,7 b' from __future__ import absolute_import' | |||
|
9 | 9 | #----------------------------------------------------------------------------- |
|
10 | 10 | |
|
11 | 11 | import sys |
|
12 |
from |
|
|
12 | from io import StringIO | |
|
13 | 13 | from unittest import TestCase |
|
14 | 14 | |
|
15 | 15 | import nose.tools as nt |
@@ -18,7 +18,7 b' import tempfile' | |||
|
18 | 18 | import shutil |
|
19 | 19 | import random |
|
20 | 20 | import time |
|
21 |
from |
|
|
21 | from io import StringIO | |
|
22 | 22 | |
|
23 | 23 | import nose.tools as nt |
|
24 | 24 | import IPython.testing.tools as tt |
@@ -1,4 +1,4 b'' | |||
|
1 |
from |
|
|
1 | from io import StringIO | |
|
2 | 2 | |
|
3 | 3 | import numpy as np |
|
4 | 4 | from IPython.testing.decorators import skip_without |
@@ -16,7 +16,10 b' Authors:' | |||
|
16 | 16 | # Imports |
|
17 | 17 | #----------------------------------------------------------------------------- |
|
18 | 18 | |
|
19 | import Cookie | |
|
19 | try: | |
|
20 | from http.cookies import SimpleCookie # Py 3 | |
|
21 | except ImportError: | |
|
22 | from Cookie import SimpleCookie # Py 2 | |
|
20 | 23 | import logging |
|
21 | 24 | from tornado import web |
|
22 | 25 | from tornado import websocket |
@@ -102,7 +105,7 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler, IPythonHandler):' | |||
|
102 | 105 | logging.error("First ws message didn't have the form 'identity:[cookie]' - %r", msg) |
|
103 | 106 | |
|
104 | 107 | try: |
|
105 |
self.request._cookies = |
|
|
108 | self.request._cookies = SimpleCookie(msg) | |
|
106 | 109 | except: |
|
107 | 110 | self.log.warn("couldn't parse cookie string: %s",msg, exc_info=True) |
|
108 | 111 |
@@ -13,7 +13,10 b' Useful for test suites and blocking terminal interfaces.' | |||
|
13 | 13 | # Imports |
|
14 | 14 | #----------------------------------------------------------------------------- |
|
15 | 15 | |
|
16 | import Queue | |
|
16 | try: | |
|
17 | from queue import Queue, Empty # Py 3 | |
|
18 | except ImportError: | |
|
19 | from Queue import Queue, Empty # Py 2 | |
|
17 | 20 | |
|
18 | 21 | from IPython.kernel.channels import IOPubChannel, HBChannel, \ |
|
19 | 22 | ShellChannel, StdInChannel |
@@ -27,7 +30,7 b' class BlockingChannelMixin(object):' | |||
|
27 | 30 | |
|
28 | 31 | def __init__(self, *args, **kwds): |
|
29 | 32 | super(BlockingChannelMixin, self).__init__(*args, **kwds) |
|
30 |
self._in_queue = Queue |
|
|
33 | self._in_queue = Queue() | |
|
31 | 34 | |
|
32 | 35 | def call_handlers(self, msg): |
|
33 | 36 | self._in_queue.put(msg) |
@@ -46,7 +49,7 b' class BlockingChannelMixin(object):' | |||
|
46 | 49 | while True: |
|
47 | 50 | try: |
|
48 | 51 | msgs.append(self.get_msg(block=False)) |
|
49 |
except |
|
|
52 | except Empty: | |
|
50 | 53 | break |
|
51 | 54 | return msgs |
|
52 | 55 |
@@ -13,7 +13,10 b'' | |||
|
13 | 13 | |
|
14 | 14 | # Standard library imports. |
|
15 | 15 | import abc |
|
16 | import Queue | |
|
16 | try: | |
|
17 | from queue import Queue # Py 3 | |
|
18 | except ImportError: | |
|
19 | from Queue import Queue # Py 2 | |
|
17 | 20 | |
|
18 | 21 | # System library imports. |
|
19 | 22 | import zmq |
@@ -45,7 +48,7 b' SocketABC.register(zmq.Socket)' | |||
|
45 | 48 | class DummySocket(HasTraits): |
|
46 | 49 | """ A dummy socket implementing (part of) the zmq.Socket interface. """ |
|
47 | 50 | |
|
48 |
queue = Instance(Queue |
|
|
51 | queue = Instance(Queue, ()) | |
|
49 | 52 | message_sent = Int(0) # Should be an Event |
|
50 | 53 | |
|
51 | 54 | #------------------------------------------------------------------------- |
@@ -11,7 +11,7 b'' | |||
|
11 | 11 | from __future__ import print_function |
|
12 | 12 | |
|
13 | 13 | # Standard library imports |
|
14 |
from |
|
|
14 | from io import StringIO | |
|
15 | 15 | import sys |
|
16 | 16 | import unittest |
|
17 | 17 |
@@ -9,7 +9,10 b'' | |||
|
9 | 9 | |
|
10 | 10 | import re |
|
11 | 11 | from subprocess import PIPE |
|
12 | from Queue import Empty | |
|
12 | try: | |
|
13 | from queue import Empty # Py 3 | |
|
14 | except ImportError: | |
|
15 | from Queue import Empty # Py 2 | |
|
13 | 16 | |
|
14 | 17 | import nose.tools as nt |
|
15 | 18 |
@@ -15,7 +15,10 b' import atexit' | |||
|
15 | 15 | |
|
16 | 16 | from contextlib import contextmanager |
|
17 | 17 | from subprocess import PIPE, STDOUT |
|
18 | from Queue import Empty | |
|
18 | try: | |
|
19 | from queue import Empty # Py 3 | |
|
20 | except ImportError: | |
|
21 | from Queue import Empty # Py 2 | |
|
19 | 22 | |
|
20 | 23 | import nose |
|
21 | 24 | import nose.tools as nt |
@@ -92,14 +92,17 b' def loop_wx(kernel):' | |||
|
92 | 92 | def loop_tk(kernel): |
|
93 | 93 | """Start a kernel with the Tk event loop.""" |
|
94 | 94 | |
|
95 | import Tkinter | |
|
95 | try: | |
|
96 | from tkinter import Tk # Py 3 | |
|
97 | except ImportError: | |
|
98 | from Tkinter import Tk # Py 2 | |
|
96 | 99 | doi = kernel.do_one_iteration |
|
97 | 100 | # Tk uses milliseconds |
|
98 | 101 | poll_interval = int(1000*kernel._poll_interval) |
|
99 | 102 | # For Tkinter, we create a Tk object and call its withdraw method. |
|
100 | 103 | class Timer(object): |
|
101 | 104 | def __init__(self, func): |
|
102 |
self.app = |
|
|
105 | self.app = Tk() | |
|
103 | 106 | self.app.withdraw() |
|
104 | 107 | self.func = func |
|
105 | 108 |
@@ -6,7 +6,10 b' except:' | |||
|
6 | 6 | import os |
|
7 | 7 | import platform |
|
8 | 8 | import time |
|
9 | from thread import interrupt_main | |
|
9 | try: | |
|
10 | from _thread import interrupt_main # Py 3 | |
|
11 | except ImportError: | |
|
12 | from thread import interrupt_main # Py 2 | |
|
10 | 13 | from threading import Thread |
|
11 | 14 | |
|
12 | 15 | from IPython.utils.warn import warn |
@@ -41,11 +41,14 b' def tkinter_clipboard_get():' | |||
|
41 | 41 | implementation that uses that toolkit. |
|
42 | 42 | """ |
|
43 | 43 | try: |
|
44 | import Tkinter | |
|
44 | from tkinter import Tk # Py 3 | |
|
45 | 45 | except ImportError: |
|
46 | raise TryNext("Getting text from the clipboard on this platform " | |
|
47 | "requires Tkinter.") | |
|
48 | root = Tkinter.Tk() | |
|
46 | try: | |
|
47 | from Tkinter import Tk # Py 2 | |
|
48 | except ImportError: | |
|
49 | raise TryNext("Getting text from the clipboard on this platform " | |
|
50 | "requires Tkinter.") | |
|
51 | root = Tk() | |
|
49 | 52 | root.withdraw() |
|
50 | 53 | text = root.clipboard_get() |
|
51 | 54 | root.destroy() |
@@ -320,8 +320,8 b' class InputHookManager(object):' | |||
|
320 | 320 | """ |
|
321 | 321 | self._current_gui = GUI_TK |
|
322 | 322 | if app is None: |
|
323 |
import |
|
|
324 |
app = |
|
|
323 | import tkinter | |
|
324 | app = tkinter.Tk() | |
|
325 | 325 | app.withdraw() |
|
326 | 326 | self._apps[GUI_TK] = app |
|
327 | 327 | return app |
@@ -109,7 +109,7 b' import sys' | |||
|
109 | 109 | import types |
|
110 | 110 | import re |
|
111 | 111 | import datetime |
|
112 |
from |
|
|
112 | from io import StringIO | |
|
113 | 113 | from collections import deque |
|
114 | 114 | |
|
115 | 115 |
@@ -8,7 +8,7 b' from __future__ import print_function' | |||
|
8 | 8 | VERBOSE = True |
|
9 | 9 | |
|
10 | 10 | # stdlib imports |
|
11 |
import |
|
|
11 | import io | |
|
12 | 12 | import sys |
|
13 | 13 | import unittest |
|
14 | 14 | |
@@ -20,7 +20,7 b' from IPython.utils.py3compat import doctest_refactor_print' | |||
|
20 | 20 | class RunnerTestCase(unittest.TestCase): |
|
21 | 21 | |
|
22 | 22 | def setUp(self): |
|
23 |
self.out = |
|
|
23 | self.out = io.StringIO() | |
|
24 | 24 | #self.out = sys.stdout |
|
25 | 25 | |
|
26 | 26 | def _test_runner(self,runner,source,output): |
@@ -7,7 +7,7 b' from __future__ import print_function' | |||
|
7 | 7 | VERBOSE = True |
|
8 | 8 | |
|
9 | 9 | # stdlib imports |
|
10 |
import |
|
|
10 | import io | |
|
11 | 11 | import sys |
|
12 | 12 | import unittest |
|
13 | 13 | import re |
@@ -28,7 +28,7 b' def pylab_not_importable():' | |||
|
28 | 28 | class RunnerTestCase(unittest.TestCase): |
|
29 | 29 | |
|
30 | 30 | def setUp(self): |
|
31 |
self.out = |
|
|
31 | self.out = io.StringIO() | |
|
32 | 32 | #self.out = sys.stdout |
|
33 | 33 | |
|
34 | 34 | def _test_runner(self,runner,source,output): |
@@ -15,7 +15,7 b' Module with tests for debug' | |||
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import sys |
|
18 |
from |
|
|
18 | from io import StringIO | |
|
19 | 19 | |
|
20 | 20 | from ...tests.base import TestsBase |
|
21 | 21 | from ..debug import DebugWriter |
@@ -16,7 +16,7 b' Module with tests for files' | |||
|
16 | 16 | |
|
17 | 17 | import sys |
|
18 | 18 | import os |
|
19 |
from |
|
|
19 | from io import StringIO | |
|
20 | 20 | |
|
21 | 21 | from ...tests.base import TestsBase |
|
22 | 22 | from ..files import FilesWriter |
@@ -15,7 +15,7 b' Module with tests for stdout' | |||
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import sys |
|
18 |
from |
|
|
18 | from io import StringIO | |
|
19 | 19 | |
|
20 | 20 | from ...tests.base import TestsBase |
|
21 | 21 | from ..stdout import StdoutWriter |
@@ -13,7 +13,10 b' Authors:' | |||
|
13 | 13 | |
|
14 | 14 | import json |
|
15 | 15 | import os |
|
16 | import cPickle as pickle | |
|
16 | try: | |
|
17 | import cPickle as pickle | |
|
18 | except ImportError: | |
|
19 | import pickle | |
|
17 | 20 | from datetime import datetime |
|
18 | 21 | |
|
19 | 22 | try: |
@@ -16,7 +16,7 b' from __future__ import print_function' | |||
|
16 | 16 | import sys |
|
17 | 17 | import tempfile |
|
18 | 18 | import time |
|
19 |
from |
|
|
19 | from io import StringIO | |
|
20 | 20 | |
|
21 | 21 | from nose import SkipTest |
|
22 | 22 |
@@ -58,7 +58,7 b' from __future__ import print_function' | |||
|
58 | 58 | #----------------------------------------------------------------------------- |
|
59 | 59 | |
|
60 | 60 | # Stdlib |
|
61 |
import |
|
|
61 | import io | |
|
62 | 62 | import os |
|
63 | 63 | import re |
|
64 | 64 | import sys |
@@ -193,7 +193,7 b' class EmbeddedSphinxShell(object):' | |||
|
193 | 193 | |
|
194 | 194 | def __init__(self): |
|
195 | 195 | |
|
196 |
self.cout = |
|
|
196 | self.cout = io.StringIO() | |
|
197 | 197 | |
|
198 | 198 | |
|
199 | 199 | # Create config object for IPython |
@@ -1,6 +1,9 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | import readline |
|
3 | from Queue import Empty | |
|
3 | try: | |
|
4 | from queue import Empty # Py 3 | |
|
5 | except ImportError: | |
|
6 | from Queue import Empty # Py 2 | |
|
4 | 7 | |
|
5 | 8 | from IPython.config import Configurable |
|
6 | 9 | from IPython.utils.traitlets import Float |
@@ -23,7 +23,10 b' import subprocess' | |||
|
23 | 23 | from io import BytesIO |
|
24 | 24 | import base64 |
|
25 | 25 | |
|
26 | from Queue import Empty | |
|
26 | try: | |
|
27 | from queue import Empty # Py 3 | |
|
28 | except ImportError: | |
|
29 | from Queue import Empty # Py 2 | |
|
27 | 30 | |
|
28 | 31 | from IPython.core import page |
|
29 | 32 | from IPython.utils.warn import warn, error |
@@ -19,7 +19,6 b' Limitations:' | |||
|
19 | 19 | # Module imports |
|
20 | 20 | |
|
21 | 21 | # From the standard library |
|
22 | import commands | |
|
23 | 22 | import doctest |
|
24 | 23 | import inspect |
|
25 | 24 | import logging |
@@ -30,7 +29,7 b' import traceback' | |||
|
30 | 29 | import unittest |
|
31 | 30 | |
|
32 | 31 | from inspect import getmodule |
|
33 |
from |
|
|
32 | from io import StringIO | |
|
34 | 33 | |
|
35 | 34 | # We are overriding the default doctest runner, so we need to import a few |
|
36 | 35 | # things from doctest directly |
@@ -38,7 +38,7 b" _scheme_default = 'Linux'" | |||
|
38 | 38 | |
|
39 | 39 | |
|
40 | 40 | # Imports |
|
41 |
import |
|
|
41 | import io | |
|
42 | 42 | import keyword |
|
43 | 43 | import os |
|
44 | 44 | import sys |
@@ -143,13 +143,13 b' class Parser:' | |||
|
143 | 143 | |
|
144 | 144 | string_output = 0 |
|
145 | 145 | if out == 'str' or self.out == 'str' or \ |
|
146 |
isinstance(self.out, |
|
|
146 | isinstance(self.out,io.StringIO): | |
|
147 | 147 | # XXX - I don't really like this state handling logic, but at this |
|
148 | 148 | # point I don't want to make major changes, so adding the |
|
149 | 149 | # isinstance() check is the simplest I can do to ensure correct |
|
150 | 150 | # behavior. |
|
151 | 151 | out_old = self.out |
|
152 |
self.out = |
|
|
152 | self.out = io.StringIO() | |
|
153 | 153 | string_output = 1 |
|
154 | 154 | elif out is not None: |
|
155 | 155 | self.out = out |
@@ -183,7 +183,7 b' class Parser:' | |||
|
183 | 183 | |
|
184 | 184 | # parse the source and write it |
|
185 | 185 | self.pos = 0 |
|
186 |
text = |
|
|
186 | text = io.StringIO(self.raw) | |
|
187 | 187 | |
|
188 | 188 | error = False |
|
189 | 189 | try: |
@@ -16,7 +16,7 b' from __future__ import print_function' | |||
|
16 | 16 | #----------------------------------------------------------------------------- |
|
17 | 17 | |
|
18 | 18 | import sys |
|
19 |
from |
|
|
19 | from io import StringIO | |
|
20 | 20 | |
|
21 | 21 | #----------------------------------------------------------------------------- |
|
22 | 22 | # Classes and functions |
@@ -24,7 +24,11 b' __docformat__ = "restructuredtext en"' | |||
|
24 | 24 | #------------------------------------------------------------------------------- |
|
25 | 25 | |
|
26 | 26 | import sys |
|
27 |
import types |
|
|
27 | import types | |
|
28 | try: | |
|
29 | import copyreg # Py 3 | |
|
30 | except ImportError: | |
|
31 | import copy_reg as copyreg # Py 2 | |
|
28 | 32 | |
|
29 | 33 | def code_ctor(*args): |
|
30 | 34 | return types.CodeType(*args) |
@@ -40,4 +44,4 b' def reduce_code(co):' | |||
|
40 | 44 | args.insert(1, co.co_kwonlyargcount) |
|
41 | 45 | return code_ctor, tuple(args) |
|
42 | 46 | |
|
43 |
copy |
|
|
47 | copyreg.pickle(types.CodeType, reduce_code) No newline at end of file |
@@ -17,7 +17,6 b' from __future__ import print_function' | |||
|
17 | 17 | import os |
|
18 | 18 | import sys |
|
19 | 19 | import tempfile |
|
20 | from StringIO import StringIO | |
|
21 | 20 | from .capture import CapturedIO, capture_output |
|
22 | 21 | from .py3compat import string_types |
|
23 | 22 |
@@ -206,7 +206,10 b' def get_home_dir(require_writable=False):' | |||
|
206 | 206 | if not _writable_dir(homedir) and os.name == 'nt': |
|
207 | 207 | # expanduser failed, use the registry to get the 'My Documents' folder. |
|
208 | 208 | try: |
|
209 | import _winreg as wreg | |
|
209 | try: | |
|
210 | import winreg as wreg # Py 3 | |
|
211 | except ImportError: | |
|
212 | import _winreg as wreg # Py 2 | |
|
210 | 213 | key = wreg.OpenKey( |
|
211 | 214 | wreg.HKEY_CURRENT_USER, |
|
212 | 215 | "Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" |
@@ -37,7 +37,10 b' from __future__ import print_function' | |||
|
37 | 37 | from IPython.external.path import path as Path |
|
38 | 38 | import os,stat,time |
|
39 | 39 | import collections |
|
40 | import cPickle as pickle | |
|
40 | try: | |
|
41 | import cPickle as pickle | |
|
42 | except ImportError: | |
|
43 | import pickle | |
|
41 | 44 | import glob |
|
42 | 45 | |
|
43 | 46 | def gethashfile(key): |
@@ -15,7 +15,7 b' from __future__ import print_function' | |||
|
15 | 15 | |
|
16 | 16 | import sys |
|
17 | 17 | |
|
18 |
from |
|
|
18 | from io import StringIO | |
|
19 | 19 | from subprocess import Popen, PIPE |
|
20 | 20 | import unittest |
|
21 | 21 |
@@ -37,15 +37,21 b' from IPython.utils.tempdir import TemporaryDirectory' | |||
|
37 | 37 | |
|
38 | 38 | # Platform-dependent imports |
|
39 | 39 | try: |
|
40 |
import |
|
|
40 | import winreg as wreg # Py 3 | |
|
41 | 41 | except ImportError: |
|
42 | #Fake _winreg module on none windows platforms | |
|
43 | import types | |
|
44 | wr_name = "winreg" if py3compat.PY3 else "_winreg" | |
|
45 | sys.modules[wr_name] = types.ModuleType(wr_name) | |
|
46 | import _winreg as wreg | |
|
47 | #Add entries that needs to be stubbed by the testing code | |
|
48 | (wreg.OpenKey, wreg.QueryValueEx,) = (None, None) | |
|
42 | try: | |
|
43 | import _winreg as wreg # Py 2 | |
|
44 | except ImportError: | |
|
45 | #Fake _winreg module on none windows platforms | |
|
46 | import types | |
|
47 | wr_name = "winreg" if py3compat.PY3 else "_winreg" | |
|
48 | sys.modules[wr_name] = types.ModuleType(wr_name) | |
|
49 | try: | |
|
50 | import winreg as wreg | |
|
51 | except ImportError: | |
|
52 | import _winreg as wreg | |
|
53 | #Add entries that needs to be stubbed by the testing code | |
|
54 | (wreg.OpenKey, wreg.QueryValueEx,) = (None, None) | |
|
49 | 55 | |
|
50 | 56 | try: |
|
51 | 57 | reload |
General Comments 0
You need to be logged in to leave comments.
Login now