|
1 | 1 | # -*- coding: utf-8 -*- |
2 | 2 | """Test suite for the deepreload module.""" |
3 | 3 |
|
4 | | -#----------------------------------------------------------------------------- |
5 | | -# Imports |
6 | | -#----------------------------------------------------------------------------- |
| 4 | +# Copyright (c) IPython Development Team. |
| 5 | +# Distributed under the terms of the Modified BSD License. |
7 | 6 |
|
8 | 7 | import os |
9 | 8 |
|
10 | 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 | 11 | from IPython.utils.syspathcontext import prepended_to_syspath |
15 | 12 | from IPython.utils.tempdir import TemporaryDirectory |
16 | 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 | 15 | def test_deepreload(): |
41 | 16 | "Test that dreload does deep reloads and skips excluded modules." |
42 | 17 | with TemporaryDirectory() as tmpdir: |
|
0 commit comments