Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 915ad09

Browse files
committed
numpy no longer seems amenable to deep reloading
Excluding numpy._globals was not sufficient to make it work, so this just removes the test for deep-reloading numpy, as it's something that no longer seems worth supporting.
1 parent f03fa54 commit 915ad09

2 files changed

Lines changed: 3 additions & 28 deletions

File tree

IPython/lib/deepreload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def deep_reload_hook(m):
328328

329329
# Replacement for reload()
330330
def reload(module, exclude=('sys', 'os.path', builtin_mod_name, '__main__',
331-
'numpy._globals')):
331+
'numpy', 'numpy._globals')):
332332
"""Recursively reload all modules used in the given module. Optionally
333333
takes a list of modules to exclude from reloading. The default exclude
334334
list contains sys, __main__, and __builtin__, to prevent, e.g., resetting

IPython/lib/tests/test_deepreload.py

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,17 @@
11
# -*- coding: utf-8 -*-
22
"""Test suite for the deepreload module."""
33

4-
#-----------------------------------------------------------------------------
5-
# Imports
6-
#-----------------------------------------------------------------------------
4+
# Copyright (c) IPython Development Team.
5+
# Distributed under the terms of the Modified BSD License.
76

87
import os
98

109
import nose.tools as nt
1110

12-
from IPython.testing import decorators as dec
13-
from IPython.utils.py3compat import builtin_mod_name, PY3
1411
from IPython.utils.syspathcontext import prepended_to_syspath
1512
from IPython.utils.tempdir import TemporaryDirectory
1613
from IPython.lib.deepreload import reload as dreload
1714

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-
4015
def test_deepreload():
4116
"Test that dreload does deep reloads and skips excluded modules."
4217
with TemporaryDirectory() as tmpdir:

0 commit comments

Comments
 (0)