Rewrite test_compatibility.py to be pytest-style
MODIFY
test/test_compatibility.py
test/test_compatibility.py
-import unittest
import warnings
+import pytest
+
from urllib3.connection import HTTPConnection
-class TestVersionCompatibility(unittest.TestCase):
+class TestVersionCompatibility(object):
def test_connection_strict(self):
with warnings.catch_warnings(record=True) as w:
warnings.simplefilter("always")
@@ -13,11 +14,11 @@ class TestVersionCompatibility(unittest.TestCase):
HTTPConnection('localhost', 12345, strict=True)
if w:
- self.fail('HTTPConnection raised warning on strict=True: %r' % w[0].message)
+ pytest.fail('HTTPConnection raised warning on strict=True: %r' % w[0].message)
def test_connection_source_address(self):
try:
# source_address does not exist in Py26-
HTTPConnection('localhost', 12345, source_address='127.0.0.1')
except TypeError as e:
- self.fail('HTTPConnection raised TypeError on source_adddress: %r' % e)
+ pytest.fail('HTTPConnection raised TypeError on source_adddress: %r' % e)

Rewrite test_compatibility.py to be pytest-style