Skip to content

Commit

Permalink
fix: traitlets5 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbreddels committed Sep 2, 2020
1 parent 212d968 commit 20ebc19
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/app/config_paths_test.py
Expand Up @@ -10,7 +10,7 @@
@pytest.fixture
def voila_config_file_paths_arg():
path = os.path.join(BASE_DIR, '..', 'configs', 'general')
return '--VoilaTest.config_file_paths=[%r]' % path
return '--VoilaTest.config_file_paths=%s' % path


def test_config_app(voila_app):
Expand Down
4 changes: 2 additions & 2 deletions tests/app/template_cli_test.py
Expand Up @@ -10,10 +10,10 @@
def voila_args_extra():
path_test_template = os.path.abspath(os.path.join(BASE_DIR, '../test_template/share/jupyter/voila/templates/test_template/'))
path_default = os.path.abspath(os.path.join(BASE_DIR, '../../share/jupyter/voila/templates/default'))
return ['--template=None', '--VoilaTest.template_paths=[%r, %r]' % (path_test_template, path_default), '--VoilaExecutor.timeout=240']
return ['--template=\'\'', '--VoilaTest.template_paths=%s' % path_test_template, '--VoilaTest.template_paths=%s' % path_default, '--VoilaExecutor.timeout=240']


async def test_template_test(http_server_client, base_url):
async def test_template_test(voila_app, http_server_client, base_url):
response = await http_server_client.fetch(base_url)
assert response.code == 200
assert 'test_template.css' in response.body.decode('utf-8')
3 changes: 2 additions & 1 deletion voila/app.py
Expand Up @@ -338,7 +338,8 @@ def initialize(self, argv=None):
signal.signal(signal.SIGTERM, self._handle_signal_stop)

def setup_template_dirs(self):
if self.voila_configuration.template:
# TODO: with traitlets 5 we cannot assign a Falsy anymore, '' is a workaround for now
if self.voila_configuration.template and self.voila_configuration.template != "''":
template_name = self.voila_configuration.template
self.template_paths = collect_template_paths(['voila', 'nbconvert'], template_name, prune=True)
self.static_paths = collect_static_paths(['voila', 'nbconvert'], template_name)
Expand Down

0 comments on commit 20ebc19

Please sign in to comment.