diff --git a/tests/test_cookies.py b/tests/test_cookies.py index 2122599..14b8ffc 100644 --- a/tests/test_cookies.py +++ b/tests/test_cookies.py @@ -239,12 +239,12 @@ def test_request_cookie_parsing(): headers = [ ( 'Cookie', - ''' + """ logged_in=no;_gh_sess=eyJzZXXzaW9uX2lkIjoiN2; tz=Europe/Berlin; _ga=GA1.2.332347814.1422308165; _gat=1; _octo=GH1.1.201722077.1422308165 - ''' + """ ), ] diff --git a/tests/test_utils.py b/tests/test_utils.py index 7e9275e..090bffd 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -2,13 +2,11 @@ from datetime import datetime import functools -import io try: import ujson as json except ImportError: import json import random -import sys import pytest import six @@ -44,18 +42,11 @@ class TestFalconUtils(testtools.TestCase): def old_thing(): pass - if six.PY3: - stream = io.StringIO() - else: - stream = io.BytesIO() + with pytest.warns(UserWarning) as rec: + old_thing() - old_stderr = sys.stderr - sys.stderr = stream - - old_thing() - - sys.stderr = old_stderr - self.assertIn(msg, stream.getvalue()) + warn = rec.pop() + assert msg in str(warn.message) def test_http_now(self): expected = datetime.utcnow()