Show More
@@ -0,0 +1,15 b'' | |||
|
1 | import sys | |
|
2 | import warnings | |
|
3 | ||
|
4 | import nose.tools as nt | |
|
5 | ||
|
6 | from IPython.utils.capture import capture_output | |
|
7 | from IPython.utils.shimmodule import ShimWarning | |
|
8 | ||
|
9 | def test_shim_warning(): | |
|
10 | sys.modules.pop('IPython.config', None) | |
|
11 | with warnings.catch_warnings(record=True) as w: | |
|
12 | warnings.simplefilter("always") | |
|
13 | import IPython.config | |
|
14 | assert len(w) == 1 | |
|
15 | assert issubclass(w[-1].category, ShimWarning) |
@@ -7,10 +7,11 b' Shim to maintain backwards compatibility with old IPython.config imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
11 | ||
|
10 | 12 | warn("The `IPython.config` package has been deprecated. " |
|
11 | "You should import from traitlets.config instead.") | |
|
13 | "You should import from traitlets.config instead.", ShimWarning) | |
|
12 | 14 | |
|
13 | from IPython.utils.shimmodule import ShimModule | |
|
14 | 15 | |
|
15 | 16 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
16 | 17 | # trigger the custom attribute access above |
@@ -15,10 +15,10 b' working, though a warning will be printed.' | |||
|
15 | 15 | import sys |
|
16 | 16 | from warnings import warn |
|
17 | 17 | |
|
18 | warn("The top-level `frontend` package has been deprecated. " | |
|
19 | "All its subpackages have been moved to the top `IPython` level.") | |
|
18 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
20 | 19 | |
|
21 | from IPython.utils.shimmodule import ShimModule | |
|
20 | warn("The top-level `frontend` package has been deprecated. " | |
|
21 | "All its subpackages have been moved to the top `IPython` level.", ShimWarning) | |
|
22 | 22 | |
|
23 | 23 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
24 | 24 | # trigger the custom attribute access above |
@@ -7,11 +7,11 b' Shim to maintain backwards compatibility with old IPython.html imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
11 | ||
|
10 | 12 | warn("The `IPython.html` package has been deprecated. " |
|
11 | 13 | "You should import from `notebook` instead. " |
|
12 | "`IPython.html.widgets` has moved to `ipywidgets`.") | |
|
13 | ||
|
14 | from IPython.utils.shimmodule import ShimModule | |
|
14 | "`IPython.html.widgets` has moved to `ipywidgets`.", ShimWarning) | |
|
15 | 15 | |
|
16 | 16 | _widgets = sys.modules['IPython.html.widgets'] = ShimModule( |
|
17 | 17 | src='IPython.html.widgets', mirror='ipywidgets') |
@@ -7,11 +7,11 b' Shim to maintain backwards compatibility with old IPython.kernel imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | warn("The `IPython.kernel` package has been deprecated. " | |
|
11 | "You should import from ipykernel or jupyter_client instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
12 | 11 | |
|
12 | warn("The `IPython.kernel` package has been deprecated. " | |
|
13 | "You should import from ipykernel or jupyter_client instead.", ShimWarning) | |
|
13 | 14 | |
|
14 | from IPython.utils.shimmodule import ShimModule | |
|
15 | 15 | |
|
16 | 16 | # zmq subdir is gone |
|
17 | 17 | sys.modules['IPython.kernel.zmq.session'] = ShimModule( |
@@ -7,10 +7,10 b' Shim to maintain backwards compatibility with old IPython.nbconvert imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | warn("The `IPython.nbconvert` package has been deprecated. " | |
|
11 | "You should import from ipython_nbconvert instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
12 | 11 | |
|
13 | from IPython.utils.shimmodule import ShimModule | |
|
12 | warn("The `IPython.nbconvert` package has been deprecated. " | |
|
13 | "You should import from ipython_nbconvert instead.", ShimWarning) | |
|
14 | 14 | |
|
15 | 15 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
16 | 16 | # trigger the custom attribute access above |
@@ -7,10 +7,10 b' Shim to maintain backwards compatibility with old IPython.nbformat imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | warn("The `IPython.nbformat` package has been deprecated. " | |
|
11 | "You should import from nbformat instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
12 | 11 | |
|
13 | from IPython.utils.shimmodule import ShimModule | |
|
12 | warn("The `IPython.nbformat` package has been deprecated. " | |
|
13 | "You should import from nbformat instead.", ShimWarning) | |
|
14 | 14 | |
|
15 | 15 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
16 | 16 | # trigger the custom attribute access above |
@@ -7,10 +7,10 b' Shim to maintain backwards compatibility with old IPython.parallel imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | warn("The `IPython.parallel` package has been deprecated. " | |
|
11 | "You should import from ipyparallel instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
12 | 11 | |
|
13 | from IPython.utils.shimmodule import ShimModule | |
|
12 | warn("The `IPython.parallel` package has been deprecated. " | |
|
13 | "You should import from ipyparallel instead.", ShimWarning) | |
|
14 | 14 | |
|
15 | 15 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
16 | 16 | # trigger the custom attribute access above |
@@ -7,10 +7,10 b' Shim to maintain backwards compatibility with old IPython.qt imports.' | |||
|
7 | 7 | import sys |
|
8 | 8 | from warnings import warn |
|
9 | 9 | |
|
10 | warn("The `IPython.qt` package has been deprecated. " | |
|
11 | "You should import from qtconsole instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
12 | 11 | |
|
13 | from IPython.utils.shimmodule import ShimModule | |
|
12 | warn("The `IPython.qt` package has been deprecated. " | |
|
13 | "You should import from qtconsole instead.", ShimWarning) | |
|
14 | 14 | |
|
15 | 15 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
16 | 16 | # trigger the custom attribute access above |
@@ -4,15 +4,13 b' Shim to maintain backwards compatibility with old IPython.terminal.console impor' | |||
|
4 | 4 | # Copyright (c) IPython Development Team. |
|
5 | 5 | # Distributed under the terms of the Modified BSD License. |
|
6 | 6 | |
|
7 | from __future__ import print_function | |
|
8 | ||
|
9 | 7 | import sys |
|
10 | 8 | from warnings import warn |
|
11 | 9 | |
|
12 | warn("The `IPython.terminal.console` package has been deprecated. " | |
|
13 | "You should import from jupyter_console instead.") | |
|
10 | from IPython.utils.shimmodule import ShimModule, ShimWarning | |
|
14 | 11 | |
|
15 | from IPython.utils.shimmodule import ShimModule | |
|
12 | warn("The `IPython.terminal.console` package has been deprecated. " | |
|
13 | "You should import from jupyter_console instead.", ShimWarning) | |
|
16 | 14 | |
|
17 | 15 | # Unconditionally insert the shim into sys.modules so that further import calls |
|
18 | 16 | # trigger the custom attribute access above |
General Comments 0
You need to be logged in to leave comments.
Login now