From cc0107b311f74c78bd653fa1a84e2dcedce9fc6f Mon Sep 17 00:00:00 2001
From: Tomas Orsava <torsava@redhat.com>
Date: Thu, 3 Oct 2019 16:17:37 +0200
Subject: [PATCH] Modify tests to run in pytest
---
test_requests.py | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/test_requests.py b/test_requests.py
index 15406a2..74aa5b3 100755
--- a/test_requests.py
+++ b/test_requests.py
@@ -7,7 +7,6 @@ from __future__ import division
import json
import os
import pickle
-import unittest
import collections
import io
@@ -53,7 +52,7 @@ def httpbin(*suffix):
return urljoin(HTTPBIN, '/'.join(suffix))
-class RequestsTestCase(unittest.TestCase):
+class TestCase():
_multiprocess_can_split_ = True
@@ -1070,7 +1069,7 @@ class RequestsTestCase(unittest.TestCase):
assert len(list(r.iter_lines())) == 3
-class TestContentEncodingDetection(unittest.TestCase):
+class TestContentEncodingDetection():
def test_none(self):
encodings = requests.utils.get_encodings_from_content('')
@@ -1114,7 +1113,7 @@ class TestContentEncodingDetection(unittest.TestCase):
assert encodings == ['HTML5', 'HTML4', 'XML']
-class TestCaseInsensitiveDict(unittest.TestCase):
+class TestCaseInsensitiveDict():
def test_mapping_init(self):
cid = CaseInsensitiveDict({'Foo': 'foo', 'BAr': 'bar'})
@@ -1252,7 +1251,7 @@ class TestCaseInsensitiveDict(unittest.TestCase):
assert frozenset(cid) == keyset
-class UtilsTestCase(unittest.TestCase):
+class UtilsTestCase():
def test_super_len_io_streams(self):
""" Ensures that we properly deal with different kinds of IO streams. """
@@ -1376,7 +1375,7 @@ class UtilsTestCase(unittest.TestCase):
assert quoted == requote_uri(quoted)
-class TestMorselToCookieExpires(unittest.TestCase):
+class TestMorselToCookieExpires():
"""Tests for morsel_to_cookie when morsel contains expires."""
@@ -1413,7 +1412,7 @@ class TestMorselToCookieExpires(unittest.TestCase):
assert cookie.expires is None
-class TestMorselToCookieMaxAge(unittest.TestCase):
+class TestMorselToCookieMaxAge():
"""Tests for morsel_to_cookie when morsel contains max-age."""
@@ -1634,6 +1633,3 @@ def test_vendor_aliases():
with pytest.raises(ImportError):
from requests.packages import webbrowser
-
-if __name__ == '__main__':
- unittest.main()
--
2.20.1