Added unittest patches for Python 2.6
diff --git a/tests/_unittest_compat.py b/tests/_unittest_compat.py
new file mode 100644
index 0000000..3064061
--- /dev/null
+++ b/tests/_unittest_compat.py
@@ -0,0 +1,72 @@
+# coding: utf-8
+from __future__ import unicode_literals, division, absolute_import, print_function
+
+import sys
+import unittest
+
+
+_non_local = {'patched': False}
+
+
+def patch():
+    if not sys.version_info < (2, 7):
+        return
+
+    if _non_local['patched']:
+        return
+
+    unittest.TestCase.assertIsInstance = _assert_is_instance
+    unittest.TestCase.assertRaises = _assert_raises
+    _non_local['patched'] = True
+
+
+def _assert_is_instance(self, obj, cls, msg=None):
+    """Same as self.assertTrue(isinstance(obj, cls)), with a nicer
+    default message."""
+    if not isinstance(obj, cls):
+        if not msg:
+            msg = '%s is not an instance of %r' % (obj, cls)
+        self.fail(msg)
+
+
+def _assert_raises(self, excClass, callableObj=None, *args, **kwargs):
+    context = _AssertRaisesContext(excClass, self)
+    if callableObj is None:
+        return context
+    with context:
+        callableObj(*args, **kwargs)
+
+
+class _AssertRaisesContext(object):
+    """A context manager used to implement TestCase.assertRaises* methods."""
+
+    def __init__(self, expected, test_case, expected_regexp=None):
+        self.expected = expected
+        self.failureException = test_case.failureException
+        self.expected_regexp = expected_regexp
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, exc_type, exc_value, tb):
+        if exc_type is None:
+            try:
+                exc_name = self.expected.__name__
+            except AttributeError:
+                exc_name = str(self.expected)
+            raise self.failureException(
+                "{0} not raised".format(exc_name))
+        if not issubclass(exc_type, self.expected):
+            # let unexpected exceptions pass through
+            return False
+        self.exception = exc_value # store for later retrieval
+        if self.expected_regexp is None:
+            return True
+
+        expected_regexp = self.expected_regexp
+        if not expected_regexp.search(str(exc_value)):
+            raise self.failureException(
+                '"%s" does not match "%s"' %
+                (expected_regexp.pattern, str(exc_value))
+            )
+        return True
diff --git a/tests/test_cms.py b/tests/test_cms.py
index 7c5945f..c8a6c41 100644
--- a/tests/test_cms.py
+++ b/tests/test_cms.py
@@ -6,7 +6,9 @@
 from datetime import datetime
 
 from asn1crypto import cms, util
+from ._unittest_compat import patch
 
+patch()
 
 tests_root = os.path.dirname(__file__)
 fixtures_dir = os.path.join(tests_root, 'fixtures')
diff --git a/tests/test_core.py b/tests/test_core.py
index ab80536..a978ed2 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -7,7 +7,9 @@
 from asn1crypto import core
 
 from .unittest_data import DataDecorator, data
+from ._unittest_compat import patch
 
+patch()
 
 tests_root = os.path.dirname(__file__)
 fixtures_dir = os.path.join(tests_root, 'fixtures')
diff --git a/tests/test_crl.py b/tests/test_crl.py
index 29dba58..6ee483d 100644
--- a/tests/test_crl.py
+++ b/tests/test_crl.py
@@ -7,6 +7,10 @@
 
 from asn1crypto import crl
 
+from ._unittest_compat import patch
+
+patch()
+
 if sys.version_info < (3,):
     byte_cls = str
     num_cls = long  #pylint: disable=E0602
diff --git a/tests/test_csr.py b/tests/test_csr.py
index 9cc8a8b..7e9dbd5 100644
--- a/tests/test_csr.py
+++ b/tests/test_csr.py
@@ -6,6 +6,9 @@
 import os
 
 from asn1crypto import csr, util
+from ._unittest_compat import patch
+
+patch()
 
 if sys.version_info < (3,):
     byte_cls = str
diff --git a/tests/test_keys.py b/tests/test_keys.py
index ebc54c7..8a03182 100644
--- a/tests/test_keys.py
+++ b/tests/test_keys.py
@@ -7,7 +7,9 @@
 from asn1crypto import keys, core, util
 
 from .unittest_data import DataDecorator, data
+from ._unittest_compat import patch
 
+patch()
 
 tests_root = os.path.dirname(__file__)
 fixtures_dir = os.path.join(tests_root, 'fixtures')
diff --git a/tests/test_ocsp.py b/tests/test_ocsp.py
index a4e4b6b..9357b27 100644
--- a/tests/test_ocsp.py
+++ b/tests/test_ocsp.py
@@ -7,6 +7,9 @@
 from datetime import datetime
 
 from asn1crypto import ocsp, util
+from ._unittest_compat import patch
+
+patch()
 
 if sys.version_info < (3,):
     byte_cls = str
diff --git a/tests/test_pem.py b/tests/test_pem.py
index c38862d..30c94ec 100644
--- a/tests/test_pem.py
+++ b/tests/test_pem.py
@@ -8,6 +8,9 @@
 from asn1crypto import pem, util
 
 from .unittest_data import DataDecorator, data
+from ._unittest_compat import patch
+
+patch()
 
 if sys.version_info < (3,):
     byte_cls = str
diff --git a/tests/test_tsp.py b/tests/test_tsp.py
index 0571c4c..a416872 100644
--- a/tests/test_tsp.py
+++ b/tests/test_tsp.py
@@ -6,7 +6,9 @@
 from datetime import datetime
 
 from asn1crypto import tsp, cms, util
+from ._unittest_compat import patch
 
+patch()
 
 tests_root = os.path.dirname(__file__)
 fixtures_dir = os.path.join(tests_root, 'fixtures')
diff --git a/tests/test_x509.py b/tests/test_x509.py
index 1843196..83463eb 100644
--- a/tests/test_x509.py
+++ b/tests/test_x509.py
@@ -9,6 +9,9 @@
 from asn1crypto import x509, core, pem, util
 
 from .unittest_data import DataDecorator, data
+from ._unittest_compat import patch
+
+patch()
 
 if sys.version_info < (3,):
     byte_cls = str