MCPcopy Create free account
hub / github.com/ipython/ipython / test_deepreload

Function test_deepreload

IPython/lib/tests/test_deepreload.py:15–34  ·  view source on GitHub ↗

Test that dreload does deep reloads and skips excluded modules.

()

Source from the content-addressed store, hash-verified

13from IPython.lib.deepreload import reload as dreload
14
15def test_deepreload():
16 "Test that dreload does deep reloads and skips excluded modules."
17 with TemporaryDirectory() as tmpdir:
18 with prepended_to_syspath(tmpdir):
19 with open(os.path.join(tmpdir, 'A.py'), 'w') as f:
20 f.write("class Object(object):\n pass\n")
21 with open(os.path.join(tmpdir, 'B.py'), 'w') as f:
22 f.write("import A\n")
23 import A
24 import B
25
26 # Test that A is not reloaded.
27 obj = A.Object()
28 dreload(B, exclude=['A'])
29 nt.assert_true(isinstance(obj, A.Object))
30
31 # Test that A is reloaded.
32 obj = A.Object()
33 dreload(B)
34 nt.assert_false(isinstance(obj, A.Object))

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45

Tested by

no test coverage detected