def test_extension():
    print('sys.path:')
    for p in sys.path:
        print(' ', p)
    print('CWD', os.getcwd())
    nt.assert_raises(ImportError, _ip.magic, 'load_ext daft_extension')
    daft_path = os.path.join(os.path.dirname(__file__), 'daft_extension')
    sys.path.insert(0, daft_path)
    try:
        _ip.user_ns.pop('arq', None)
        invalidate_caches()
        _ip.magic('load_ext daft_extension')
        nt.assert_equal(_ip.user_ns['arq'], 185)
        _ip.magic('unload_ext daft_extension')
        assert ('arq' not in _ip.user_ns)
    finally:
        sys.path.remove(daft_path)
def test_extension():
    print('sys.path:')
    for p in sys.path:
        print(' ', p)
    print('CWD', os.getcwd())
    nt.assert_raises(ImportError, _ip.magic, 'load_ext daft_extension')
    daft_path = os.path.join(os.path.dirname(__file__), 'daft_extension')
    sys.path.insert(0, daft_path)
    try:
        _ip.user_ns.pop('arq', None)
        invalidate_caches()
        _ip.magic('load_ext daft_extension')
        nt.assert_equal(_ip.user_ns['arq'], 185)
        _ip.magic('unload_ext daft_extension')
        assert ('arq' not in _ip.user_ns)
    finally:
        sys.path.remove(daft_path)