diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2016-05-09 21:02:39 +0200 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2016-05-09 21:03:16 +0200 |
commit | c3e3e4dcbb1459e8b93be3bddca4cbcbdb971362 (patch) | |
tree | 79b3c4934a10eedbe672a8349e8e76ee88686fc8 | |
parent | 9e63feed9e4c053b969afe9ff51e27807b04d484 (diff) | |
download | raven-c3e3e4dcbb1459e8b93be3bddca4cbcbdb971362.tar.gz |
Fixed tests for python 35.16.0
-rw-r--r-- | tests/breadcrumbs/tests.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tests/breadcrumbs/tests.py b/tests/breadcrumbs/tests.py index 85f6192..ab424d8 100644 --- a/tests/breadcrumbs/tests.py +++ b/tests/breadcrumbs/tests.py @@ -6,10 +6,7 @@ from raven.utils.testutils import TestCase from raven.base import Client from raven.breadcrumbs import record_breadcrumb -try: - from cStringIO import StringIO as BytesIO -except ImportError: - from io import BytesIO +from io import StringIO class BreadcrumbTestCase(TestCase): @@ -38,13 +35,13 @@ class BreadcrumbTestCase(TestCase): assert crumbs[0]['message'] == 'This is a message with foo!' def test_log_location(self): - out = BytesIO() + out = StringIO() logger = logging.getLogger(__name__) logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(out) handler.setFormatter(logging.Formatter( - '%(name)s|%(filename)s|%(funcName)s|%(lineno)d|' - '%(levelname)s|%(message)s')) + u'%(name)s|%(filename)s|%(funcName)s|%(lineno)d|' + u'%(levelname)s|%(message)s')) logger.addHandler(handler) client = Client('http://foo:bar@example.com/0') @@ -52,10 +49,10 @@ class BreadcrumbTestCase(TestCase): logger.info('Hello World!') lineno = sys._getframe().f_lineno - 1 - items = out.getvalue().strip().decode('utf-8').split('|') - assert items[0] == b'tests.breadcrumbs.tests' - assert items[1].rstrip(b'co') == b'tests.py' - assert items[2] == b'test_log_location' + items = out.getvalue().strip().split('|') + assert items[0] == 'tests.breadcrumbs.tests' + assert items[1].rstrip('co') == 'tests.py' + assert items[2] == 'test_log_location' assert int(items[3]) == lineno - assert items[4] == b'INFO' - assert items[5] == b'Hello World!' + assert items[4] == 'INFO' + assert items[5] == 'Hello World!' |