]> Cypherpunks.ru repositories - pyderasn.git/blobdiff - tests/test_cms.py
Remove Py27 compatibility
[pyderasn.git] / tests / test_cms.py
index 04477a6534354fd03a8aedae02e4abb21ce385d9..1936b6ea2617f1a069ed4938feec33b7c12e0930 100644 (file)
@@ -31,8 +31,6 @@ from unittest import TestCase
 from hypothesis import given
 from hypothesis import settings
 from hypothesis.strategies import integers
-from six import PY2
-from six.moves import xrange as six_xrange
 
 from pyderasn import agg_octet_string
 from pyderasn import Any
@@ -285,7 +283,7 @@ class TestSignedDataCERWithOpenSSL(TestCase):
             ci.encode_cer(fd.write)
         self.verify(cert_path, cms_path)
         fd = open(cms_path, "rb")
-        raw = memoryview(fd.read()) if PY2 else file_mmaped(fd)
+        raw = file_mmaped(fd)
         ctx = {"bered": True}
         for decode_path, obj, _ in ContentInfo().decode_evgen(raw, ctx=ctx):
             if decode_path == ("content",):
@@ -301,13 +299,12 @@ class TestSignedDataCERWithOpenSSL(TestCase):
         data_path = self.tmpfile()
         start = time()
         with open(data_path, "wb") as fd:
-            for _ in six_xrange(int(environ.get("PYDERASN_TEST_CMS_HUGE"))):
+            for _ in range(int(environ.get("PYDERASN_TEST_CMS_HUGE"))):
                 # dgst.update(rnd)
                 fd.write(rnd)
         print("data file written", time() - start)
         return file_mmaped(open(data_path, "rb"))
 
-    @skipIf(PY2, "no mmaped memoryview support in PY2")
     @skipIf("PYDERASN_TEST_CMS_HUGE" not in environ, "PYDERASN_TEST_CMS_HUGE is not set")
     def test_huge_cer(self):
         """Huge CMS test
@@ -319,7 +316,7 @@ class TestSignedDataCERWithOpenSSL(TestCase):
         """
         data_raw = self.create_huge_file()
         key_path, cert_path, cert, skid = self.keypair()
-        from sys import getallocatedblocks  # PY2 does not have it
+        from sys import getallocatedblocks
         mem_start = getallocatedblocks()
         start = time()
         eci = EncapsulatedContentInfo((
@@ -385,7 +382,6 @@ class TestSignedDataCERWithOpenSSL(TestCase):
         self.verify(cert_path, cms_path)
         eci_fd.close()
 
-    @skipIf(PY2, "no mmaped memoryview support in PY2")
     @skipIf("PYDERASN_TEST_CMS_HUGE" not in environ, "PYDERASN_TEST_CMS_HUGE is not set")
     def test_huge_der_2pass(self):
         """Same test as above, but 2pass DER encoder and just signature verification