Skip to content

Commit

Permalink
Unicode support
Browse files Browse the repository at this point in the history
  • Loading branch information
sirex committed Jan 4, 2016
1 parent eb73c4c commit 0601bd6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pytest_catchlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest
import py
import six


__version__ = '1.2.1'
Expand Down Expand Up @@ -263,7 +264,7 @@ def __call__(self):
class CallableList(CallablePropertyMixin, list):
pass

class CallableStr(CallablePropertyMixin, str):
class CallableStr(CallablePropertyMixin, six.text_type):
pass


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _get_version():
author_email='eisensheng@mailbox.org',
url='https://github.com/eisensheng/pytest-catchlog',
py_modules=['pytest_catchlog', ],
install_requires=['py>=1.1.1', 'pytest>=2.6'],
install_requires=['py>=1.1.1', 'pytest>=2.6', 'six'],
entry_points={'pytest11': ['pytest_catchlog = pytest_catchlog']},
license='MIT License',
zip_safe=False,
Expand Down
21 changes: 21 additions & 0 deletions test_pytest_catchlog.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# coding: utf-8

import py

pytest_plugins = 'pytester'
Expand Down Expand Up @@ -159,6 +161,25 @@ def test_foo(caplog):
assert result.ret == 0


def test_unicode(testdir):
testdir.makepyfile(u'''
# coding: utf-8
from __future__ import unicode_literals
import sys
import logging
def test_foo(caplog):
logging.getLogger().info(u'bū')
assert caplog.records[0].levelname == 'INFO'
assert caplog.records[0].msg == u'bū'
assert u'bū' in caplog.text
''')
result = testdir.runpytest()
assert result.ret == 0


def test_funcarg_help(testdir):
result = testdir.runpytest('--funcargs')
result.stdout.fnmatch_lines(['*caplog*'])
Expand Down

0 comments on commit 0601bd6

Please sign in to comment.