mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-09 03:50:45 +08:00
Merge pull request #1168 from minrk/allow-root-notebook-dir
allow notebook-dir to be root
This commit is contained in:
commit
2018e800dc
@ -805,6 +805,11 @@ class NotebookApp(JupyterApp):
|
||||
|
||||
def _notebook_dir_validate(self, value, trait):
|
||||
# Strip any trailing slashes
|
||||
# *except* if it's root
|
||||
_, path = os.path.splitdrive(value)
|
||||
if path == os.sep:
|
||||
return value
|
||||
|
||||
value = value.rstrip(os.sep)
|
||||
|
||||
if not os.path.isabs(value):
|
||||
|
@ -68,6 +68,11 @@ def test_nb_dir_with_slash():
|
||||
app = NotebookApp(notebook_dir=td)
|
||||
nt.assert_false(app.notebook_dir.endswith("/"))
|
||||
|
||||
def test_nb_dir_root():
|
||||
root = os.path.abspath(os.sep) # gets the right value on Windows, Posix
|
||||
app = NotebookApp(notebook_dir=root)
|
||||
nt.assert_equal(app.notebook_dir, root)
|
||||
|
||||
def test_generate_config():
|
||||
with TemporaryDirectory() as td:
|
||||
app = NotebookApp(config_dir=td)
|
||||
|
Loading…
Reference in New Issue
Block a user