コード例 #1
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 '@quantlab/python-tests' in _get_extensions(app_dir)

        install_extension(self.source_dir, app_dir)
        assert glob.glob(app_path)
        assert '@quantlab/python-tests' in _get_extensions(app_dir)

        uninstall_extension('@quantlab/python-tests', app_dir)
        assert not glob.glob(app_path)
        assert glob.glob(sys_path)
        assert '@quantlab/python-tests' in _get_extensions(app_dir)

        uninstall_extension('@quantlab/python-tests', app_dir)
        assert not glob.glob(app_path)
        assert not glob.glob(sys_path)
        assert '@quantlab/python-tests' not in _get_extensions(app_dir)
コード例 #2
0
 def test_enable_extension(self):
     app_dir = self.tempdir()
     install_extension(self.source_dir, app_dir)
     disable_extension('@quantlab/python-tests', app_dir)
     enable_extension('@quantlab/python-tests', app_dir)
     disabled = _get_disabled(app_dir)
     assert '@quantlab/python-tests' not in disabled
コード例 #3
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)
コード例 #4
0
    def test_install_mime_renderer(self):
        install_extension(self.mime_renderer_dir)
        assert '@quantlab/mime-extension-test' in _get_extensions(self.app_dir)

        uninstall_extension('@quantlab/mime-extension-test')
        assert '@quantlab/mime-extension-test' not in _get_extensions(
            self.app_dir)
コード例 #5
0
 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 '@quantlab/python-tests' in _get_extensions(self.app_dir)
コード例 #6
0
 def test_should_build(self):
     assert not should_build()[0]
     install_extension(self.source_dir)
     assert should_build()[0]
     build()
     assert not should_build()[0]
     uninstall_extension('@quantlab/python-tests')
     assert should_build()[0]
コード例 #7
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 '@quantlab/python-tests' in _get_extensions(app_dir)
コード例 #8
0
    def test_build(self):
        install_extension(self.source_dir)
        build()
        # check staging directory.
        entry = pjoin(self.app_dir, 'staging', 'build', 'index.out.js')
        with open(entry) as fid:
            data = fid.read()
        assert '@quantlab/python-tests' in data

        # check static directory.
        entry = pjoin(self.app_dir, 'static', 'index.out.js')
        with open(entry) as fid:
            data = fid.read()
        assert '@quantlab/python-tests' in data
コード例 #9
0
    def test_build_custom(self):
        install_extension(self.source_dir)
        build(name='foo', version='1.0')

        # check static directory.
        entry = pjoin(self.app_dir, 'static', 'index.out.js')
        with open(entry) as fid:
            data = fid.read()
        assert '@quantlab/python-tests' in data

        pkg = pjoin(self.app_dir, 'static', 'package.json')
        with open(pkg) as fid:
            data = json.load(fid)
        assert data['quantlab']['name'] == 'foo'
        assert data['quantlab']['version'] == '1.0'
コード例 #10
0
    def test_uninstall_core_extension(self):
        uninstall_extension('@quantlab/console-extension')
        app_dir = self.app_dir
        _ensure_package(app_dir)
        with open(pjoin(app_dir, 'staging', 'package.json')) as fid:
            data = json.load(fid)
        extensions = data['quantlab']['extensions']
        assert '@quantlab/console-extension' not in extensions

        install_extension('@quantlab/console-extension')
        _ensure_package(app_dir)
        with open(pjoin(app_dir, 'staging', 'package.json')) as fid:
            data = json.load(fid)
        extensions = data['quantlab']['extensions']
        assert '@quantlab/console-extension' in extensions
コード例 #11
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 '@quantlab/python-tests' in _get_extensions(app_dir)

        uninstall_extension('@quantlab/python-tests', app_dir)
        path = pjoin(app_dir, 'extensions', '*python-tests*.tgz')
        assert not glob.glob(path)
        assert '@quantlab/python-tests' not in _get_extensions(app_dir)

        link_package(self.source_dir, app_dir)
        linked = _get_linked_packages(app_dir).keys()
        assert '@quantlab/python-tests' in linked

        unlink_package(self.source_dir, app_dir)
        linked = _get_linked_packages(app_dir).keys()
        assert '@quantlab/python-tests' not in linked
コード例 #12
0
 def test_list_extensions(self):
     install_extension(self.source_dir)
     list_extensions()
コード例 #13
0
 def test_link_incompatible(self):
     with pytest.raises(ValueError) as excinfo:
         install_extension(self.incompat_dir)
     assert 'Conflicting Dependencies' in str(excinfo.value)
コード例 #14
0
 def test_uninstall_extension(self):
     install_extension(self.source_dir)
     uninstall_extension('@quantlab/python-tests')
     path = pjoin(self.app_dir, 'extensions', '*python_tests*.tgz')
     assert not glob.glob(path)
     assert '@quantlab/python-tests' not in _get_extensions(self.app_dir)