From 4b88360661f29ed10a7738793577b360929c82f7 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 17 Oct 2022 15:24:09 +0400 Subject: [PATCH] Mark failing tests --- tests/test_multipart_encoder.py | 4 ++++ tests/test_socket_options_adapter.py | 7 +++++++ tests/test_x509_adapter.py | 2 ++ tox.ini | 1 + 4 files changed, 14 insertions(+) diff --git a/tests/test_multipart_encoder.py b/tests/test_multipart_encoder.py index 575f54c4..bf2539e9 100644 --- a/tests/test_multipart_encoder.py +++ b/tests/test_multipart_encoder.py @@ -4,6 +4,7 @@ import requests +import pytest from requests_toolbelt.multipart.encoder import ( CustomBytesIO, MultipartEncoder, FileFromURLWrapper, FileNotSupportedError) from requests_toolbelt._compat import filepost @@ -94,6 +95,7 @@ def setUp(self): s = requests.Session() self.recorder = get_betamax(s) + @pytest.mark.xfail def test_read_file(self): url = ('https://stxnext.com/static/img/logo.830ebe551641.svg') with self.recorder.use_cassette( @@ -110,6 +112,7 @@ def test_read_file(self): assert chunk == b'ww.w3.org/' assert self.instance.len == 5147 + @pytest.mark.xfail(strict=False) def test_no_content_length_header(self): url = ( 'https://api.github.com/repos/sigmavirus24/github3.py/releases/' @@ -191,6 +194,7 @@ def test_reads_open_file_objects(self): m = MultipartEncoder([('field', 'foo'), ('file', fd)]) assert m.read() is not None + @pytest.mark.xfail def test_reads_file_from_url_wrapper(self): s = requests.Session() recorder = get_betamax(s) diff --git a/tests/test_socket_options_adapter.py b/tests/test_socket_options_adapter.py index 5694bacd..414772e8 100644 --- a/tests/test_socket_options_adapter.py +++ b/tests/test_socket_options_adapter.py @@ -1,8 +1,11 @@ # -*- coding: utf-8 -*- """Tests for the SocketOptionsAdapter and TCPKeepAliveAdapter.""" import contextlib +import platform import socket +import sys +import pytest try: from unittest import mock except ImportError: @@ -72,6 +75,8 @@ def test_options_not_passed_on_older_requests(PoolManager): assert PoolManager.called is False +@pytest.mark.xfail(sys.version_info.major == 2 and platform.system() == "Windows", + reason="Windows does not have TCP_KEEPINTVL in Python 2") @mock.patch.object(requests, '__build__', 0x020500) @mock.patch.object(poolmanager, 'PoolManager') def test_keep_alive_on_newer_requests_no_idle(PoolManager): @@ -96,6 +101,8 @@ def test_keep_alive_on_newer_requests_no_idle(PoolManager): assert adapter.socket_options == socket_opts +@pytest.mark.xfail(sys.version_info.major == 2 and platform.system() == "Windows", + reason="Windows does not have TCP_KEEPINTVL in Python 2") @mock.patch.object(requests, '__build__', 0x020500) @mock.patch.object(poolmanager, 'PoolManager') def test_keep_alive_on_newer_requests_with_idle(PoolManager): diff --git a/tests/test_x509_adapter.py b/tests/test_x509_adapter.py index b8a8eb5a..bcc00b0f 100644 --- a/tests/test_x509_adapter.py +++ b/tests/test_x509_adapter.py @@ -33,6 +33,7 @@ def setUp(self): self.pkcs12_password_bytes = "test".encode('utf8') self.session = requests.Session() + @pytest.mark.xfail @pytest.mark.skipif(not REQUESTS_SUPPORTS_SSL_CONTEXT, reason="Requires Requests v2.12.0 or later") @pytest.mark.skipif(not PYOPENSSL_AVAILABLE, @@ -55,6 +56,7 @@ def test_x509_pem(self): assert r.status_code == 200 assert r.text + @pytest.mark.xfail @pytest.mark.skipif(not REQUESTS_SUPPORTS_SSL_CONTEXT, reason="Requires Requests v2.12.0 or later") @pytest.mark.skipif(not PYOPENSSL_AVAILABLE, diff --git a/tox.ini b/tox.ini index 6536b258..be886a85 100644 --- a/tox.ini +++ b/tox.ini @@ -76,3 +76,4 @@ commands = [pytest] addopts = -q norecursedirs = *.egg .git .* _* +xfail_strict = true