mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 22:43:00 +00:00
BUG: Fix str/unicode warnings from SQLAlchemy on python 2.
When running with `reset_db=True` on python 2, several SQLAlchemy operations were performed with bytes where unicode was expected, resulting in warnings like the following. ``` /home/ssanderson/.virtualenvs/jupyterhub/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py:573: SAWarning: Unicode type received non-unicodebind param value. param.append(processors[key](compiled_params[key])) ``` Fixes a few stray non-unicode literals and adds a unicode safe wrapper for `getpass.getuser`.
This commit is contained in:
@@ -3,13 +3,13 @@
|
||||
# Copyright (c) Jupyter Development Team.
|
||||
# Distributed under the terms of the Modified BSD License.
|
||||
|
||||
import getpass
|
||||
import logging
|
||||
|
||||
from pytest import fixture
|
||||
from tornado import ioloop
|
||||
|
||||
from .. import orm
|
||||
from ..utils import getuser_unicode
|
||||
|
||||
from .mocking import MockHubApp
|
||||
|
||||
@@ -24,7 +24,7 @@ def db():
|
||||
if _db is None:
|
||||
_db = orm.new_session('sqlite:///:memory:', echo=True)
|
||||
user = orm.User(
|
||||
name=getpass.getuser(),
|
||||
name=getuser_unicode(),
|
||||
server=orm.Server(),
|
||||
)
|
||||
hub = orm.Hub(
|
||||
|
Reference in New Issue
Block a user