def notebook(qtbot):
    """Set up the Notebook plugin with a welcome tab and a tab with a new
    notebook. The latter tab is selected."""
    notebook_plugin = NotebookPlugin(None, testing=True)
    qtbot.addWidget(notebook_plugin)
    notebook_plugin.tabwidget.maybe_create_welcome_client()
    notebook_plugin.create_new_client()
    return notebook_plugin
Beispiel #2
0
def plugin_no_server(mocker, qtbot):
    """Set up the Notebook plugin with a fake nbopen which does not start
    a notebook server."""
    def fake_get_server(filename, interpreter, start):
        return collections.defaultdict(
            str, filename=filename, notebook_dir=osp.dirname(filename))
    fake_server_manager = mocker.Mock(get_server=fake_get_server)
    mocker.patch('spyder_notebook.notebookplugin.ServerManager',
                 return_value=fake_server_manager)
    plugin = NotebookPlugin(None, testing=True)
    plugin.main = mocker.Mock()
    qtbot.addWidget(plugin)
    yield plugin
    plugin.closing_plugin()
Beispiel #3
0
def setup_notebook(qtbot):
    """Set up the Notebook plugin."""
    notebook = NotebookPlugin(None, testing=True)
    qtbot.addWidget(notebook)
    notebook.create_new_client()
    notebook.show()
    return notebook
def plugin_no_server(mocker, qtbot):
    """Set up the Notebook plugin with a fake nbopen which does not start
    a notebook server."""
    def fake_nbopen(filename):
        return collections.defaultdict(str,
                                       filename=filename,
                                       notebook_dir=osp.dirname(filename))

    mocker.patch('spyder_notebook.widgets.notebooktabwidget.nbopen',
                 fake_nbopen)
    plugin = NotebookPlugin(None, testing=True)
    qtbot.addWidget(plugin)
    mocker.patch.object(plugin, 'main')
    return plugin
def notebook(qtbot):
    """Set up the Notebook plugin."""
    notebook_plugin = NotebookPlugin(None, testing=True)
    qtbot.addWidget(notebook_plugin)
    notebook_plugin.create_new_client()
    return notebook_plugin