コード例 #1
0
def components(build_path, monkeypatch):
    """App with all components."""
    monkeypatch.setattr(App, '_sourcefile',
                        lambda self: 'bowtie.tests.test_components')

    controllers, visuals = create_components()

    app = App(rows=len(visuals))
    for controller in controllers:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[controller._uuid] == controller
        app.add_sidebar(controller)

    for vis in visuals:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[vis._uuid] == vis
        app.add(vis)

    # pylint: disable=protected-access
    app._build()

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(),
                                       os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'),
                              env=env)

    time.sleep(5)
    yield
    server.kill()
コード例 #2
0
def multiple_views(build_path, monkeypatch):
    """Create multiple views app."""
    monkeypatch.setattr(App, '_sourcefile',
                        lambda self: 'bowtie.tests.test_multiple')

    app = App()
    view1 = View()  # pylint: disable=unused-variable
    assert view1._uuid == 2  # pylint: disable=protected-access
    view2 = View()
    view2.add(table)
    app.add_route(view2, 'view2')

    app.add(table)
    app.add_sidebar(ctrl)
    app.add_sidebar(ctrl2)
    app.subscribe(callback, ctrl.on_change)
    app.subscribe(callback, ctrl2.on_click)

    app._build()  # pylint: disable=protected-access

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(),
                                       os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'),
                              env=env)

    time.sleep(5)
    yield
    server.kill()
コード例 #3
0
def components(build_reset, monkeypatch):
    """App with all components."""
    controllers, visuals, htmls = create_components()

    app = App(__name__, rows=len(visuals), sidebar=True)
    for controller in controllers:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[controller._uuid] == controller
        app.add_sidebar(controller)

    for vis in visuals:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[vis._uuid] == vis
        app.add(vis)

    for htm in htmls:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[htm._uuid] == htm
        app.add_sidebar(htm)

    assert len(
        COMPONENT_REGISTRY) == len(controllers) + 2 * len(visuals) + len(htmls)

    # pylint: disable=protected-access
    app._build()

    # run second time to make sure nothing weird happens with subsequent builds
    app._build()

    with server_check(app) as server:
        yield server
コード例 #4
0
ファイル: test_components.py プロジェクト: jwkvam/bowtie
def components(build_reset, monkeypatch):
    """App with all components."""
    controllers, visuals, htmls = create_components()

    app = App(__name__, rows=len(visuals), sidebar=True)
    for controller in controllers:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[controller._uuid] == controller
        app.add_sidebar(controller)

    for vis in visuals:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[vis._uuid] == vis
        app.add(vis)

    for htm in htmls:
        # pylint: disable=protected-access
        assert COMPONENT_REGISTRY[htm._uuid] == htm
        app.add_sidebar(htm)

    assert len(COMPONENT_REGISTRY) == len(controllers) + 2 * len(visuals) + len(htmls)

    # pylint: disable=protected-access
    app._build()

    # run second time to make sure nothing weird happens with subsequent builds
    app._build()

    with server_check(app) as server:
        yield server
コード例 #5
0
ファイル: test_cache.py プロジェクト: ylwb/bowtie
def dummy(build_reset, monkeypatch):
    """Create basic app."""
    app = App(__name__)
    app.add(button)
    app.subscribe(button.on_click)(click)
    app._build()  # pylint: disable=protected-access

    with server_check(app) as server:
        yield server
コード例 #6
0
ファイル: test_cache.py プロジェクト: jwkvam/bowtie
def dummy(build_reset, monkeypatch):
    """Create basic app."""
    app = App(__name__)
    app.add(button)
    app.subscribe(button.on_click)(click)
    app._build()  # pylint: disable=protected-access

    with server_check(app) as server:
        yield server
コード例 #7
0
ファイル: test_editor.py プロジェクト: jwkvam/bowtie
def markdown(build_reset, monkeypatch):
    """Create markdown and text widgets."""
    app = App(__name__, sidebar=True)
    app.add(mark)
    app.add_sidebar(side)
    app.add_sidebar(text)
    app.subscribe(text.on_change)(write)
    # pylint: disable=protected-access
    app._build()

    with server_check(app) as server:
        yield server
コード例 #8
0
ファイル: test_cache.py プロジェクト: zz38/bowtie
def dummy(build_path, monkeypatch):
    """Create basic app."""
    monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_cache')

    app = App()
    app.add(button)
    app.subscribe(click, button.on_click)
    # pylint: disable=protected-access
    app._build()

    with server_check(build_path) as server:
        yield server
コード例 #9
0
ファイル: test_compile.py プロジェクト: ylwb/bowtie
def test_build(build_reset, monkeypatch):
    """Tests the build process."""
    reset_uuid()
    ctrl = Nouislider()
    viz = Plotly()

    app = App(__name__, sidebar=True)
    app.add_sidebar(ctrl)
    app.add(viz)
    app.subscribe(ctrl.on_change)(callback)
    # pylint: disable=protected-access
    app._build()
コード例 #10
0
ファイル: test_editor.py プロジェクト: rdiaz18/vue
def markdown(build_reset, monkeypatch):
    """Create markdown and text widgets."""
    app = App(__name__, sidebar=True)
    app.add(mark)
    app.add_sidebar(side)
    app.add_sidebar(text)
    app.subscribe(text.on_change)(write)
    # pylint: disable=protected-access
    app._build()

    with server_check(app) as server:
        yield server
コード例 #11
0
ファイル: test_plotly.py プロジェクト: jwkvam/bowtie
def plotly(build_reset, monkeypatch):
    """Create plotly app."""
    app = App(__name__, sidebar=True)
    app.add(viz)
    app.add_sidebar(ctrl)
    app.add_sidebar(ctrl_range)
    app.add_sidebar(ctrl2)
    app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback))
    # pylint: disable=protected-access
    app._build()

    with server_check(app) as server:
        yield server
コード例 #12
0
ファイル: test_compile.py プロジェクト: thomasstryb/bowtie
def test_build(build_path, monkeypatch):
    """Tests the build process."""
    monkeypatch.setattr(App, '_sourcefile',
                        lambda self: 'bowtie.tests.test_compile')
    reset_uuid()
    ctrl = Nouislider()
    viz = Plotly()

    app = App()
    app.add_sidebar(ctrl)
    app.add(viz)
    app.subscribe(callback, ctrl.on_change)
    # pylint: disable=protected-access
    app._build()
コード例 #13
0
def multiple_views(build_reset, monkeypatch):
    """Create multiple views app."""
    app = App(__name__, sidebar=True)
    view1 = View()  # pylint: disable=unused-variable
    assert view1._uuid == 2  # pylint: disable=protected-access
    view2 = View()
    view2.add(table)
    app.add_route(view2, 'view2')

    app.add(table)
    app.add_sidebar(ctrl)
    app.add_sidebar(ctrl2)
    app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback))

    app._build()  # pylint: disable=protected-access

    with server_check(app) as server:
        yield server
コード例 #14
0
ファイル: test_multiple.py プロジェクト: jwkvam/bowtie
def multiple_views(build_reset, monkeypatch):
    """Create multiple views app."""
    app = App(__name__, sidebar=True)
    view1 = View()  # pylint: disable=unused-variable
    assert view1._uuid == 2  # pylint: disable=protected-access
    view2 = View()
    view2.add(table)
    app.add_route(view2, 'view2')

    app.add(table)
    app.add_sidebar(ctrl)
    app.add_sidebar(ctrl2)
    app.subscribe(ctrl.on_change)(app.subscribe(ctrl2.on_click)(callback))

    app._build()  # pylint: disable=protected-access

    with server_check(app) as server:
        yield server
コード例 #15
0
ファイル: test_plotly.py プロジェクト: zz38/bowtie
def plotly(build_path, monkeypatch):
    """Create plotly app."""
    monkeypatch.setattr(App, '_sourcefile', lambda self: 'bowtie.tests.test_plotly')

    app = App()
    app.add(viz)
    app.add_sidebar(ctrl)
    app.add_sidebar(ctrl_range)
    app.add_sidebar(ctrl2)
    app.subscribe(callback, ctrl.on_change)
    app.subscribe(callback, ctrl2.on_click)
    # pylint: disable=protected-access
    app._build()

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(), os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'), env=env)

    time.sleep(5)
    yield
    server.kill()
コード例 #16
0
def markdown(build_path, monkeypatch):
    """Create markdown and text widgets."""
    monkeypatch.setattr(App, '_sourcefile',
                        lambda self: 'bowtie.tests.test_editor')

    app = App()
    app.add(mark)
    app.add_sidebar(side)
    app.add_sidebar(text)
    app.subscribe(write, text.on_change)
    # pylint: disable=protected-access
    app._build()

    env['PYTHONPATH'] = '{}:{}'.format(os.getcwd(),
                                       os.environ.get('PYTHONPATH', ''))
    server = subprocess.Popen(os.path.join(build_path, 'src/server.py'),
                              env=env)

    time.sleep(5)
    yield
    server.kill()