Rebase PR #1468 : Allow root user to run tests

Allow root user to run tests.

(c) Copyright IBM Corp. 2015
This commit is contained in:
Justin Tyberg 2016-05-18 22:05:19 -04:00 committed by Matthias Bussonnier
parent cc83c2f32c
commit e1ff71d3cf
3 changed files with 9 additions and 5 deletions

View File

@ -1,6 +1,9 @@
# Installs Jupyter Notebook and IPython kernel from the current branch
# Another Docker container should inherit with `FROM jupyter/notebook`
# to run actual services.
#
# For opinionated stacks of ready-to-run Jupyter applications in Docker,
# check out docker-stacks <https://github.com/jupyter/docker-stacks>
FROM ubuntu:14.04
@ -105,4 +108,4 @@ WORKDIR /notebooks
EXPOSE 8888
ENTRYPOINT ["tini", "--"]
CMD ["jupyter", "notebook"]
CMD ["jupyter", "notebook", "--no-browser", "--allow-root"]

View File

@ -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 @@ class NotebookTestBase(TestCase):
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"""
@ -84,7 +84,7 @@ class NotebookTestBase(TestCase):
cls.data_dir = data_dir
cls.runtime_dir = TemporaryDirectory()
cls.notebook_dir = TemporaryDirectory()
started = Event()
def start_thread():
app = cls.notebook = NotebookApp(
@ -97,6 +97,7 @@ class NotebookTestBase(TestCase):
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

View File

@ -76,7 +76,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'))