Skip to content

Commit

Permalink
Merge pull request #158 from Jamim/fix/warnings
Browse files Browse the repository at this point in the history
Fix deprecation warning from traitlets
  • Loading branch information
minrk authored Aug 5, 2019
2 parents 7cb0a28 + 92295af commit 9d0a86b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 6 additions & 5 deletions jupyter_core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

from traitlets.config.application import Application, catch_config_error
from traitlets.config.loader import ConfigFileNotFound
from traitlets import Unicode, Bool, List
from traitlets import Unicode, Bool, List, observe

from .utils import ensure_dir_exists
from ipython_genutils import py3compat
Expand Down Expand Up @@ -98,10 +98,11 @@ def _runtime_dir_default(self):
rd = jupyter_runtime_dir()
ensure_dir_exists(rd, mode=0o700)
return rd

def _runtime_dir_changed(self, new):
ensure_dir_exists(new, mode=0o700)


@observe('runtime_dir')
def _runtime_dir_changed(self, change):
ensure_dir_exists(change['new'], mode=0o700)

generate_config = Bool(False, config=True,
help="""Generate default config file."""
)
Expand Down
9 changes: 9 additions & 0 deletions jupyter_core/tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def test_load_config():
shutil.rmtree(config_dir)
shutil.rmtree(wd)


def test_load_bad_config():
config_dir = mkdtemp()
wd = mkdtemp()
Expand All @@ -108,3 +109,11 @@ def test_load_bad_config():
shutil.rmtree(config_dir)
shutil.rmtree(wd)


def test_runtime_dir_changed():
app = DummyApp()
td = mkdtemp()
shutil.rmtree(td)
app.runtime_dir = td
assert os.path.isdir(td)
shutil.rmtree(td)

0 comments on commit 9d0a86b

Please sign in to comment.