##// END OF EJS Templates
numpy no longer seems amenable to deep reloading...
Thomas Kluyver -
Show More
@@ -328,7 +328,7 b' except AttributeError:'
328
328
329 # Replacement for reload()
329 # Replacement for reload()
330 def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__',
330 def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__',
331 'numpy._globals')):
331 'numpy', 'numpy._globals')):
332 """Recursively reload all modules used in the given module. Optionally
332 """Recursively reload all modules used in the given module. Optionally
333 takes a list of modules to exclude from reloading. The default exclude
333 takes a list of modules to exclude from reloading. The default exclude
334 list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
334 list contains sys, __main__, and __builtin__, to prevent, e.g., resetting
@@ -1,42 +1,17 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 """Test suite for the deepreload module."""
2 """Test suite for the deepreload module."""
3
3
4 #-----------------------------------------------------------------------------
4 # Copyright (c) IPython Development Team.
5 # Imports
5 # Distributed under the terms of the Modified BSD License.
6 #-----------------------------------------------------------------------------
7
6
8 import os
7 import os
9
8
10 import nose.tools as nt
9 import nose.tools as nt
11
10
12 from IPython.testing import decorators as dec
13 from IPython.utils.py3compat import builtin_mod_name, PY3
14 from IPython.utils.syspathcontext import prepended_to_syspath
11 from IPython.utils.syspathcontext import prepended_to_syspath
15 from IPython.utils.tempdir import TemporaryDirectory
12 from IPython.utils.tempdir import TemporaryDirectory
16 from IPython.lib.deepreload import reload as dreload
13 from IPython.lib.deepreload import reload as dreload
17
14
18 #-----------------------------------------------------------------------------
19 # Test functions begin
20 #-----------------------------------------------------------------------------
21
22 @dec.skipif_not_numpy
23 def test_deepreload_numpy():
24 "Test that NumPy can be deep reloaded."
25 import numpy
26 # TODO: Find a way to exclude all standard library modules from reloading.
27 exclude = [
28 # Standard exclusions:
29 'sys', 'os.path', builtin_mod_name, '__main__',
30 # Test-related exclusions:
31 'unittest', 'UserDict', '_collections_abc', 'tokenize',
32 'collections', 'collections.abc',
33 'importlib', 'importlib.machinery', '_imp',
34 'importlib._bootstrap', 'importlib._bootstrap_external',
35 '_frozen_importlib', '_frozen_importlib_external',
36 ]
37
38 dreload(numpy, exclude=exclude)
39
40 def test_deepreload():
15 def test_deepreload():
41 "Test that dreload does deep reloads and skips excluded modules."
16 "Test that dreload does deep reloads and skips excluded modules."
42 with TemporaryDirectory() as tmpdir:
17 with TemporaryDirectory() as tmpdir:
General Comments 0
You need to be logged in to leave comments. Login now