From 71a8573fdbb31d54f1384cae0063ab024d44bfe5 Mon Sep 17 00:00:00 2001 From: Min RK Date: Tue, 5 Feb 2019 11:38:42 +0100 Subject: [PATCH] fix some deprecation warnings in tests Calling HasTraits(attr=value) doesn't work for non-traits 1. remove one redundant assignment for a non-trait 2. make one attribute a trait --- jupyterhub/tests/conftest.py | 2 +- jupyterhub/tests/mocking.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jupyterhub/tests/conftest.py b/jupyterhub/tests/conftest.py index 0c490079..77dcc6d4 100644 --- a/jupyterhub/tests/conftest.py +++ b/jupyterhub/tests/conftest.py @@ -76,7 +76,7 @@ def app(request, io_loop, ssl_tmpdir): """Mock a jupyterhub app for testing""" mocked_app = None ssl_enabled = getattr(request.module, "ssl_enabled", False) - kwargs = dict(log_level=logging.DEBUG) + kwargs = dict() if ssl_enabled: kwargs.update( dict( diff --git a/jupyterhub/tests/mocking.py b/jupyterhub/tests/mocking.py index 44205427..a1e8c555 100644 --- a/jupyterhub/tests/mocking.py +++ b/jupyterhub/tests/mocking.py @@ -40,7 +40,7 @@ from tornado import gen from tornado.concurrent import Future from tornado.ioloop import IOLoop -from traitlets import Bool, default +from traitlets import Bool, Dict, default from ..app import JupyterHub from ..auth import PAMAuthenticator @@ -219,12 +219,15 @@ class MockPAMAuthenticator(PAMAuthenticator): class MockHub(JupyterHub): """Hub with various mock bits""" + # disable some inherited traits with hardcoded values db_file = None last_activity_interval = 2 log_datefmt = '%M:%S' - external_certs = None log_level = 10 + # MockHub additional traits + external_certs = Dict() + def __init__(self, *args, **kwargs): if 'internal_certs_location' in kwargs: cert_location = kwargs['internal_certs_location']