summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Pradet <quentin.pradet@gmail.com>2019-09-25 16:52:50 +0400
committerSeth Michael Larson <sethmichaellarson@gmail.com>2019-09-25 07:52:50 -0500
commit4a6c28838c1fa132035142738029b449ce4585ae (patch)
tree3f319a38e0a05e394253c94b4e91b38ca232bd2a
parent6b4ac9b6b973c405d3e58aaa4ef1ad86252208c0 (diff)
downloadurllib3-4a6c28838c1fa132035142738029b449ce4585ae.tar.gz
Fix PyPy tests (#1694)
-rw-r--r--.travis.yml4
-rw-r--r--test/test_response.py5
-rw-r--r--test/test_ssl.py6
-rw-r--r--test/with_dummyserver/test_socketlevel.py6
4 files changed, 15 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml
index 11cdc0ae..4de108cc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -102,10 +102,6 @@ matrix:
script:
- ./_travis/deploy.sh
- allow_failures:
- - python: pypy3.5-6.0
- - python: pypy2.7-6.0
-
stages:
- name: test
if: tag IS blank
diff --git a/test/test_response.py b/test/test_response.py
index 45ef2498..c6a9c3ad 100644
--- a/test/test_response.py
+++ b/test/test_response.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+import re
import socket
import zlib
@@ -413,7 +414,7 @@ class TestResponse(object):
# method which is provided by `BufferedReader` wrapper
resp = BufferedReader(resp)
list(TextIOWrapper(resp))
- assert str(ctx.value) == "I/O operation on closed file."
+ assert re.match("I/O operation on closed file.?", str(ctx.value))
def test_io_not_autoclose_textiowrapper(self):
fp = BytesIO(
@@ -437,7 +438,7 @@ class TestResponse(object):
assert resp.closed
with pytest.raises(ValueError) as ctx:
next(reader)
- assert str(ctx.value) == "I/O operation on closed file."
+ assert re.match("I/O operation on closed file.?", str(ctx.value))
def test_streaming(self):
fp = BytesIO(b"foo")
diff --git a/test/test_ssl.py b/test/test_ssl.py
index 38b93434..f714c8da 100644
--- a/test/test_ssl.py
+++ b/test/test_ssl.py
@@ -1,3 +1,6 @@
+import platform
+import sys
+
import mock
import pytest
from urllib3.util import ssl_
@@ -125,6 +128,9 @@ def test_wrap_socket_given_context_no_load_default_certs():
def test_wrap_socket_given_ca_certs_no_load_default_certs(monkeypatch):
+ if platform.python_implementation() == "PyPy" and sys.version_info[0] == 2:
+ # https://github.com/testing-cabal/mock/issues/438
+ pytest.xfail("fails with PyPy for Python 2 dues to funcsigs bug")
context = mock.create_autospec(ssl_.SSLContext)
context.load_default_certs = mock.Mock()
context.options = 0
diff --git a/test/with_dummyserver/test_socketlevel.py b/test/with_dummyserver/test_socketlevel.py
index 2e5e9db8..93c9ae88 100644
--- a/test/with_dummyserver/test_socketlevel.py
+++ b/test/with_dummyserver/test_socketlevel.py
@@ -1,5 +1,7 @@
# TODO: Break this module up into pieces. Maybe group by functionality tested
# rather than the socket level-ness of it.
+import platform
+import sys
from urllib3 import HTTPConnectionPool, HTTPSConnectionPool
from urllib3.poolmanager import proxy_from_url
@@ -1350,6 +1352,10 @@ class TestSSL(SocketDummyServerTestCase):
context.load_default_certs.assert_called_with()
def test_ssl_dont_load_default_certs_when_given(self):
+ if platform.python_implementation() == "PyPy" and sys.version_info[0] == 2:
+ # https://github.com/testing-cabal/mock/issues/438
+ pytest.xfail("fails with PyPy for Python 2 dues to funcsigs bug")
+
def socket_handler(listener):
sock = listener.accept()[0]
ssl_sock = ssl.wrap_socket(