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

Function test_extension

IPython/core/tests/test_magic.py:714–732  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

712 nt.assert_equal(_ip.user_ns['x'], '\t')
713
714def test_extension():
715 # Debugging information for failures of this test
716 print('sys.path:')
717 for p in sys.path:
718 print(' ', p)
719 print('CWD', os.getcwd())
720
721 nt.assert_raises(ImportError, _ip.magic, "load_ext daft_extension")
722 daft_path = os.path.join(os.path.dirname(__file__), "daft_extension")
723 sys.path.insert(0, daft_path)
724 try:
725 _ip.user_ns.pop('arq', None)
726 invalidate_caches() # Clear import caches
727 _ip.magic("load_ext daft_extension")
728 nt.assert_equal(_ip.user_ns['arq'], 185)
729 _ip.magic("unload_ext daft_extension")
730 assert 'arq' not in _ip.user_ns
731 finally:
732 sys.path.remove(daft_path)
733
734
735def test_notebook_export_json():

Callers

nothing calls this directly

Calls 3

popMethod · 0.80
magicMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected