def test_app_dir_shadowing(self): app_dir = self.tempdir() sys_dir = get_app_dir() if os.path.exists(sys_dir): os.removedirs(sys_dir) install_extension(self.source_dir) sys_path = pjoin(sys_dir, 'extensions', '*python-tests*.tgz') assert glob.glob(sys_path) app_path = pjoin(app_dir, 'extensions', '*python-tests*.tgz') assert not glob.glob(app_path) assert '@jupyterlab/python-tests' in list_extensions(app_dir) install_extension(self.source_dir, app_dir) assert glob.glob(app_path) assert '@jupyterlab/python-tests' in list_extensions(app_dir) uninstall_extension('@jupyterlab/python-tests', app_dir) assert not glob.glob(app_path) assert glob.glob(sys_path) assert '@jupyterlab/python-tests' in list_extensions(app_dir) uninstall_extension('@jupyterlab/python-tests', app_dir) assert not glob.glob(app_path) assert not glob.glob(sys_path) assert '@jupyterlab/python-tests' not in list_extensions(app_dir)
def test_unlink_package(self): target = self.source_dir link_package(target) unlink_package(target) linked = _get_linked_packages().keys() assert '@jupyterlab/python-tests' not in linked assert '@jupyterlab/python-tests' not in list_extensions()
def test_install_failed(self): path = os.path.realpath(pjoin(here, '..')) with pytest.raises(ValueError): install_extension(path) with open(pjoin(path, 'package.json')) as fid: data = json.load(fid) assert not data['name'] in list_extensions()
def test_app_dir_use_sys_prefix(self): app_dir = self.tempdir() if os.path.exists(get_app_dir()): os.removedirs(get_app_dir()) install_extension(self.source_dir) path = pjoin(app_dir, 'extensions', '*python-tests*.tgz') assert not glob.glob(path) assert '@jupyterlab/python-tests' in list_extensions(app_dir)
def test_link_package(self): path = os.path.realpath(pjoin(here, '..')) link_package(path) linked = _get_linked_packages().keys() with open(pjoin(path, 'package.json')) as fid: data = json.load(fid) assert data['name'] in linked assert not data['name'] in list_extensions() unlink_package(path) linked = _get_linked_packages().keys() assert not data['name'] in linked
def test_app_dir(self): app_dir = self.tempdir() install_extension(self.source_dir, app_dir) path = pjoin(app_dir, 'extensions', '*python-tests*.tgz') assert glob.glob(path) assert '@jupyterlab/python-tests' in list_extensions(app_dir) uninstall_extension('@jupyterlab/python-tests', app_dir) path = pjoin(app_dir, 'extensions', '*python-tests*.tgz') assert not glob.glob(path) assert '@jupyterlab/python-tests' not in list_extensions(app_dir) link_package(self.source_dir, app_dir) linked = _get_linked_packages(app_dir).keys() assert '@jupyterlab/python-tests' in linked unlink_package(self.source_dir, app_dir) linked = _get_linked_packages(app_dir).keys() assert '@jupyterlab/python-tests' not in linked
def test_uninstall_extension(self): install_extension(self.source_dir) uninstall_extension('@jupyterlab/python-tests') path = pjoin(get_app_dir(), 'extensions', '*python_tests*.tgz') assert not glob.glob(path) assert '@jupyterlab/python-tests' not in list_extensions()
def test_list_extensions(self): install_extension(self.source_dir) extensions = list_extensions() assert '@jupyterlab/python-tests' in extensions
def test_list_extensions(self): install_extension(self.mock_extension) list_extensions()
def test_link_package(self): link_package(self.source_dir) linked = _get_linked_packages().keys() assert '@jupyterlab/python-tests' in linked assert '@jupyterlab/python-tests' in list_extensions()
def test_list_extensions(self): install_extension(self.source_dir) list_extensions()
def test_link_extension(self): link_package(self.source_dir) linked = _get_linked_packages().keys() assert '@jupyterlab/python-tests' in linked assert '@jupyterlab/python-tests' in list_extensions()
def test_list_extensions(self): install_extension(pjoin(here, 'mockextension')) extensions = list_extensions() assert '@jupyterlab/python-tests' in extensions
def test_list_extensions(self): assert install_extension(self.mock_extension) is True list_extensions()