From 7002b18dcbe44da551a35b65f6a32d42f0b90021 Mon Sep 17 00:00:00 2001 From: Justin Tyberg Date: Wed, 18 May 2016 22:05:19 -0400 Subject: [PATCH 1/2] Allow root user to run tests. (c) Copyright IBM Corp. 2015 --- notebook/tests/launchnotebook.py | 7 ++++--- notebook/tests/test_notebookapp.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/notebook/tests/launchnotebook.py b/notebook/tests/launchnotebook.py index 2537a5b9a4..b0990cf59b 100644 --- a/notebook/tests/launchnotebook.py +++ b/notebook/tests/launchnotebook.py @@ -34,7 +34,7 @@ class TimeoutError(Exception): class NotebookTestBase(TestCase): """A base class for tests that need a running notebook. - + This create some empty config and runtime directories and then starts the notebook server with them. """ @@ -60,7 +60,7 @@ def wait_until_alive(cls): return raise TimeoutError("The notebook server didn't start up correctly.") - + @classmethod def wait_until_dead(cls): """Wait for the server process to terminate after shutdown""" @@ -85,7 +85,7 @@ def setup_class(cls): cls.data_dir = data_dir cls.runtime_dir = TemporaryDirectory() cls.notebook_dir = TemporaryDirectory() - + started = Event() def start_thread(): app = cls.notebook = NotebookApp( @@ -98,6 +98,7 @@ def start_thread(): notebook_dir=cls.notebook_dir.name, base_url=cls.url_prefix, config=cls.config, + allow_root=True, ) # don't register signal handler during tests app.init_signal = lambda : None diff --git a/notebook/tests/test_notebookapp.py b/notebook/tests/test_notebookapp.py index afb6d921a1..2d535ec899 100644 --- a/notebook/tests/test_notebookapp.py +++ b/notebook/tests/test_notebookapp.py @@ -77,7 +77,7 @@ def test_nb_dir_root(): def test_generate_config(): with TemporaryDirectory() as td: app = NotebookApp(config_dir=td) - app.initialize(['--generate-config']) + app.initialize(['--generate-config', '--allow-root']) with nt.assert_raises(NoStart): app.start() assert os.path.exists(os.path.join(td, 'jupyter_notebook_config.py')) From 61730bd6de8d36360ffbf24ba30cf5d963b6b354 Mon Sep 17 00:00:00 2001 From: Justin Tyberg Date: Wed, 18 May 2016 22:05:59 -0400 Subject: [PATCH 2/2] Add "--allow-root". (c) Copyright IBM Corp. 2015 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1514b29970..3b1e7a90e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ # Another Docker container should inherit with `FROM jupyter/notebook` # to run actual services. # -# For opinionated stacks of ready-to-run Jupyter applications in Docker, +# For opinionated stacks of ready-to-run Jupyter applications in Docker, # check out docker-stacks FROM jupyter/ubuntu_14_04_locale_fix @@ -109,4 +109,4 @@ WORKDIR /notebooks EXPOSE 8888 ENTRYPOINT ["tini", "--"] -CMD ["jupyter", "notebook", "--no-browser"] +CMD ["jupyter", "notebook", "--no-browser", "--allow-root"]