Skip to content

Commit

Permalink
PR feedback, fixes travis build.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Shawver committed Aug 22, 2018
1 parent cfcd8b4 commit c21aef4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 26 deletions.
28 changes: 9 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
language: python
sudo: false

matrix:
include:
- python: 2.7
env: NB_VERSION=notebook4
- python: 2.7
env: NB_VERSION=notebook5

- python: 3.4
env: NB_VERSION=notebook4
- python: 3.4
env: NB_VERSION=notebook5

- python: 3.6
env: NB_VERSION=notebook4
- python: 3.6
env: NB_VERSION=notebook5

- env: FLAKE8=true
- env: NOTEST=true
python:
- "2.7"
- "3.4"
- "3.6"
env:
- NB_VERSION=4
- NB_VERSION=5
- FLAKE8=true NB_VERSION=5
- NOTEST=true NB_VERSION=5

addons:
postgresql: "9.3"
Expand Down
15 changes: 10 additions & 5 deletions pgcontents/pgmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
save_file,
)
from .utils.ipycompat import Bool, ContentsManager, from_dict
from traitlets import default


class PostgresContentsManager(PostgresManagerMixin, ContentsManager):
Expand All @@ -69,15 +70,18 @@ class PostgresContentsManager(PostgresManagerMixin, ContentsManager):
help="Create a root directory automatically?",
)

def _checkpoints_class_default(self):
@default('checkpoints_class')
def _default_checkpoints_class(self):
return PostgresCheckpoints

def _checkpoints_kwargs_default(self):
@default('checkpoints_kwargs')
def _default_checkpoints_kwargs(self):
klass = PostgresContentsManager
try:
klass = PostgresContentsManager
kw = super(klass, self)._checkpoints_kwargs_default()
except AttributeError:
kw = {'parent': self, 'log': self.log}
kw = super(klass, self)._default_checkpoints_kwargs()

kw.update({
'create_user_on_startup': self.create_user_on_startup,
'crypto': self.crypto,
Expand All @@ -87,7 +91,8 @@ def _checkpoints_kwargs_default(self):
})
return kw

def _create_directory_on_startup_default(self):
@default('create_directory_on_startup')
def _default_create_directory_on_startup(self):
return self.create_user_on_startup

def __init__(self, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions pgcontents/tests/test_pgcontents_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ def test_list_checkpoints_sorting(self):
# support backing up the deleted directory in the OS trash can.
# FileContentsManager should allow non-empty directories to be deleted.
def test_delete_non_empty_dir(self):
if issubclass(self.notebook.contents_manager_class,
if isinstance(self.notebook.contents_manager,
PostgresContentsManager):
# make sure non-empty directories cannot be deleted with
# PostgresContentsManager
_test_delete_non_empty_dir_fail(self, u'å b')
elif issubclass(self.notebook.contents_manager_class,
elif isinstance(self.notebook.contents_manager,
HybridContentsManager):
# check that one of the non-empty subdirectories owned by the
# PostgresContentsManager cannnot be deleted
Expand Down

0 comments on commit c21aef4

Please sign in to comment.