##// END OF EJS Templates
Merge pull request #12591 from dswij/pathlib_testdeepreload
Matthias Bussonnier -
r26076:92860b58 merge
parent child Browse files
Show More
@@ -4,7 +4,7 b''
4 4 # Copyright (c) IPython Development Team.
5 5 # Distributed under the terms of the Modified BSD License.
6 6
7 import os
7 from pathlib import Path
8 8
9 9 import nose.tools as nt
10 10
@@ -12,20 +12,22 b' from IPython.utils.syspathcontext import prepended_to_syspath'
12 12 from IPython.utils.tempdir import TemporaryDirectory
13 13 from IPython.lib.deepreload import reload as dreload
14 14
15
15 16 def test_deepreload():
16 17 "Test that dreload does deep reloads and skips excluded modules."
17 18 with TemporaryDirectory() as tmpdir:
18 19 with prepended_to_syspath(tmpdir):
19 with open(os.path.join(tmpdir, 'A.py'), 'w') as f:
20 tmpdirpath = Path(tmpdir)
21 with open(tmpdirpath / "A.py", "w") as f:
20 22 f.write("class Object(object):\n pass\n")
21 with open(os.path.join(tmpdir, 'B.py'), 'w') as f:
23 with open(tmpdirpath / "B.py", "w") as f:
22 24 f.write("import A\n")
23 25 import A
24 26 import B
25 27
26 28 # Test that A is not reloaded.
27 29 obj = A.Object()
28 dreload(B, exclude=['A'])
30 dreload(B, exclude=["A"])
29 31 nt.assert_true(isinstance(obj, A.Object))
30 32
31 33 # Test that A is reloaded.
General Comments 0
You need to be logged in to leave comments. Login now