##// END OF EJS Templates
Fix indentation of the transformer regex
Fix indentation of the transformer regex

File last commit:

r26043:df8a993a
r26495:40a57d40
Show More
test_deepreload.py
36 lines | 1.1 KiB | text/x-python | PythonLexer
/ IPython / lib / tests / test_deepreload.py
Bradley M. Froehle
Reformat test to a standard style.
r6534 # -*- coding: utf-8 -*-
Bradley M. Froehle
Add deepreload unit test....
r6533 """Test suite for the deepreload module."""
Thomas Kluyver
numpy no longer seems amenable to deep reloading...
r22971 # Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
Bradley M. Froehle
Reformat test to a standard style.
r6534
dswij
use pathlib on test_deepreload
r26042 from pathlib import Path
Bradley M. Froehle
Add deepreload functionality test.
r6535
import nose.tools as nt
Bradley M. Froehle
Clean up sys.path entry.
r6541 from IPython.utils.syspathcontext import prepended_to_syspath
Bradley M. Froehle
Add deepreload functionality test.
r6535 from IPython.utils.tempdir import TemporaryDirectory
Bradley M. Froehle
Add deepreload unit test....
r6533 from IPython.lib.deepreload import reload as dreload
dswij
run black
r26043
Bradley M. Froehle
Add deepreload functionality test.
r6535 def test_deepreload():
"Test that dreload does deep reloads and skips excluded modules."
with TemporaryDirectory() as tmpdir:
Bradley M. Froehle
Clean up sys.path entry.
r6541 with prepended_to_syspath(tmpdir):
dswij
use pathlib on test_deepreload
r26042 tmpdirpath = Path(tmpdir)
dswij
run black
r26043 with open(tmpdirpath / "A.py", "w") as f:
Bradley M. Froehle
Clean up sys.path entry.
r6541 f.write("class Object(object):\n pass\n")
dswij
run black
r26043 with open(tmpdirpath / "B.py", "w") as f:
Bradley M. Froehle
Clean up sys.path entry.
r6541 f.write("import A\n")
import A
import B
# Test that A is not reloaded.
obj = A.Object()
dswij
run black
r26043 dreload(B, exclude=["A"])
Bradley M. Froehle
Clean up sys.path entry.
r6541 nt.assert_true(isinstance(obj, A.Object))
# Test that A is reloaded.
obj = A.Object()
dreload(B)
nt.assert_false(isinstance(obj, A.Object))