def test_app_dir_shadowing(self):
        app_dir = self.tempdir()
        sys_dir = self.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 _get_extensions(app_dir)

        install_extension(self.source_dir, app_dir)
        assert glob.glob(app_path)
        assert '@jupyterlab/python-tests' in _get_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 _get_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 _get_extensions(app_dir)
Example #2
0
    def test_app_dir_shadowing(self):
        app_dir = self.tempdir()
        sys_dir = self.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 _get_extensions(app_dir)

        install_extension(self.source_dir, app_dir)
        assert glob.glob(app_path)
        assert '@jupyterlab/python-tests' in _get_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 _get_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 _get_extensions(app_dir)
    def test_install_mime_renderer(self):
        install_extension(self.mock_mimeextension)
        assert '@jupyterlab/mime-extension-test' in _get_extensions(
            self.app_dir)

        uninstall_extension('@jupyterlab/mime-extension-test')
        assert '@jupyterlab/mime-extension-test' not in _get_extensions(
            self.app_dir)
Example #4
0
    def test_link_mime_renderer(self):
        link_package(self.mime_renderer_dir)
        linked = _get_linked_packages().keys()
        assert '@jupyterlab/mime-extension-test' in linked
        assert '@jupyterlab/mime-extension-test' in _get_extensions(self.app_dir)

        unlink_package('@jupyterlab/mime-extension-test')
        linked = _get_linked_packages().keys()
        assert '@jupyterlab/mime-extension-test' not in linked
        assert '@jupyterlab/mime-extension-test' not in _get_extensions(self.app_dir)
    def test_link_mime_renderer(self):
        link_package(self.mime_renderer_dir)
        linked = _get_linked_packages().keys()
        assert '@jupyterlab/mime-extension-test' in linked
        assert '@jupyterlab/mime-extension-test' in _get_extensions(self.app_dir)

        unlink_package('@jupyterlab/mime-extension-test')
        linked = _get_linked_packages().keys()
        assert '@jupyterlab/mime-extension-test' not in linked
        assert '@jupyterlab/mime-extension-test' not in _get_extensions(self.app_dir)
 def test_install_failed(self):
     path = self.mock_package
     with pytest.raises(ValueError):
         install_extension(path)
     with open(pjoin(path, 'package.json')) as fid:
         data = json.load(fid)
     assert not data['name'] in _get_extensions(self.app_dir)
 def test_install_twice(self):
     install_extension(self.mock_extension)
     path = pjoin(commands.get_app_dir(), 'extensions',
                  '*python-tests*.tgz')
     install_extension(self.mock_extension)
     assert glob.glob(path)
     assert '@jupyterlab/python-tests' in _get_extensions(self.app_dir)
Example #8
0
 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 _get_extensions(self.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 _get_extensions(self.app_dir)
Example #10
0
 def test_install_failed(self):
     path = self.mock_package
     with pytest.raises(ValueError):
         install_extension(path)
     with open(pjoin(path, 'package.json')) as fid:
         data = json.load(fid)
     assert not data['name'] in _get_extensions(self.app_dir)
    def test_app_dir_use_sys_prefix(self):
        app_dir = self.tempdir()
        if os.path.exists(self.app_dir):
            os.removedirs(self.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 _get_extensions(app_dir)
Example #12
0
    def test_app_dir_use_sys_prefix(self):
        app_dir = self.tempdir()
        if os.path.exists(self.app_dir):
            os.removedirs(self.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 _get_extensions(app_dir)
Example #13
0
    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 _get_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 _get_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
Example #14
0
 def test_link_package(self):
     path = self.mock_package
     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 _get_extensions(self.app_dir)
     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 _get_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 _get_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_link_package(self):
     path = self.mock_package
     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 _get_extensions(self.app_dir)
     unlink_package(path)
     linked = _get_linked_packages().keys()
     assert not data['name'] in linked
 def test_install_twice(self):
     install_extension(self.source_dir)
     path = pjoin(commands.get_app_dir(), 'extensions', '*python-tests*.tgz')
     install_extension(self.source_dir)
     assert glob.glob(path)
     assert '@jupyterlab/python-tests' in _get_extensions(self.app_dir)
Example #18
0
 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 _get_extensions(self.app_dir)
Example #19
0
 def test_uninstall_extension(self):
     install_extension(self.source_dir)
     uninstall_extension('@jupyterlab/python-tests')
     path = pjoin(self.app_dir, 'extensions', '*python_tests*.tgz')
     assert not glob.glob(path)
     assert '@jupyterlab/python-tests' not in _get_extensions(self.app_dir)
    def test_install_mime_renderer(self):
        install_extension(self.mime_renderer_dir)
        assert '@jupyterlab/mime-extension-test' in _get_extensions(self.app_dir)

        uninstall_extension('@jupyterlab/mime-extension-test')
        assert '@jupyterlab/mime-extension-test' not in _get_extensions(self.app_dir)
 def test_uninstall_extension(self):
     install_extension(self.source_dir)
     uninstall_extension('@jupyterlab/python-tests')
     path = pjoin(self.app_dir, 'extensions', '*python_tests*.tgz')
     assert not glob.glob(path)
     assert '@jupyterlab/python-tests' not in _get_extensions(self.app_dir)
 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 _get_extensions(self.app_dir)