예제 #1
0
    def test_civis_setup_success(self, get_notebook,
                                 find_and_install_requirements, config_jupyter,
                                 _stage_new_notebook):
        c = Config({})
        notebook_config.civis_setup(c)

        assert (c.NotebookApp.default_url == '/notebooks/notebook.ipynb')
        config_jupyter.assert_called_with(ANY)
        get_notebook.assert_called_with(notebook_config.ROOT_DIR +
                                        '/notebook.ipynb')
        find_and_install_requirements.assert_called_with(
            notebook_config.ROOT_DIR, ANY)
    def test_civis_setup_uses_environment_setting(
            self,
            log_file_has_logs, get_notebook, find_and_install_requirements,
            config_jupyter, environ_get, _stage_new_notebook):

        c = Config({})
        log_file_has_logs.return_value = False
        environ_get.return_value = 'subpath/foo.ipynb'
        notebook_config.civis_setup(c)
        assert(c.NotebookApp.default_url == '/notebooks/subpath/foo.ipynb')
        config_jupyter.assert_called_with(ANY)
        get_notebook.assert_called_with(notebook_config.ROOT_DIR + '/subpath/foo.ipynb')
        find_and_install_requirements.assert_called_with(notebook_config.ROOT_DIR + '/subpath', ANY)
 def test_civis_setup_redirects_to_logs(self, log_file_has_logs, _config_jupyter):
     c = Config({})
     log_file_has_logs.return_value = True
     notebook_config.civis_setup(c)
     assert(c.NotebookApp.default_url == log_utils.USER_LOGS_URL)
예제 #4
0
"""Jupyter configuration file

Note that the code in this file gets executed in a python process that is independent
of any python process in a kernel run by Jupyter (e.g., an ipython kernel). Thus we can make
changes to the installed packages to use in the ipython kernel here without worrying about
them not being reimported.
"""
from civis_jupyter_notebooks import notebook_config

c = get_config() # noqa
notebook_config.civis_setup(c)