Repository: pauldmccarthy/indexed_gzip (language: python)

Issue:
TEST: don't try and load 8GB into RAM in CI



Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5cdc68e..c9e120df 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,7 +1,7 @@
 # `indexed_gzip` changelog
 
 
-## 1.6.0 (May 25th 2021)
+## 1.6.0 (May 26th 2021)
 
 
 * Python 2.7 wheels for Windows are no longer being built (#71, 73).


Test patch:
diff --git a/indexed_gzip/tests/ctest_zran.pyx b/indexed_gzip/tests/ctest_zran.pyx
index ca9649ca..76381f4c 100644
--- a/indexed_gzip/tests/ctest_zran.pyx
+++ b/indexed_gzip/tests/ctest_zran.pyx
@@ -1292,35 +1292,38 @@ def test_crc_validation(concat):
             pybuf = <bytes>(<char *>buffer)[:dsize]
             assert np.all(np.frombuffer(pybuf, dtype=np.uint32) == data)
 
+    def wrap(val):
+        return val % 255
+
     # data/crc is good, all should be well
     _run_crc_tests(True)
 
     # corrupt the size, we should get an error
-    cmpdata[-1] += 1  # corrupt size
+    cmpdata[-1] = wrap(cmpdata[-1] + 1)  # corrupt size
     _run_crc_tests(False)
 
     # corrupt the crc, we should get an error
-    cmpdata[-1] -= 1  # restore size to correct value
-    cmpdata[-5] += 1  # corrupt crc
+    cmpdata[-1] = wrap(cmpdata[-1] - 1)  # restore size to correct value
+    cmpdata[-5] = wrap(cmpdata[-5] + 1)  # corrupt crc
     _run_crc_tests(False)
 
     # Corrupt a different stream, if we have more than one
-    cmpdata[-5] -= 1  # restore crc to correct value
+    cmpdata[-5] = wrap(cmpdata[-5] - 1)  # restore crc to correct value
     if len(strmoffs) > 1:
         for off in strmoffs[1:]:
-            cmpdata[off-1] += 1
+            cmpdata[off-1] = wrap(cmpdata[off-1] + 1)
             _run_crc_tests(False)
-            cmpdata[off-1] -= 1
+            cmpdata[off-1] = wrap(cmpdata[off-1] - 1)
 
     # Disable CRC, all should be well, even with a corrupt CRC/size
     # First test with good data
     _run_crc_tests(True, zran.ZRAN_AUTO_BUILD | zran.ZRAN_SKIP_CRC_CHECK)
 
-    cmpdata[-1] += 1  # corrupt size
+    cmpdata[-1] = wrap(cmpdata[-1] + 1)  # corrupt size
     _run_crc_tests(True, zran.ZRAN_AUTO_BUILD | zran.ZRAN_SKIP_CRC_CHECK)
 
-    cmpdata[-1] -= 1  # restore size to correct value
-    cmpdata[-5] -= 1  # corrupt crc
+    cmpdata[-1] = wrap(cmpdata[-1] - 1)  # restore size to correct value
+    cmpdata[-5] = wrap(cmpdata[-5] - 1)  # corrupt crc
     _run_crc_tests(True, zran.ZRAN_AUTO_BUILD | zran.ZRAN_SKIP_CRC_CHECK)
 
 
diff --git a/indexed_gzip/tests/test_indexed_gzip.py b/indexed_gzip/tests/test_indexed_gzip.py
index e34c9142..ca9eff65 100644
--- a/indexed_gzip/tests/test_indexed_gzip.py
+++ b/indexed_gzip/tests/test_indexed_gzip.py
@@ -85,8 +85,8 @@ def test_read_all_drop_handles(testfile, nelems, use_mmap):
 def test_simple_read_with_null_padding():
     ctest_indexed_gzip.test_simple_read_with_null_padding()
 
-def test_read_with_null_padding(testfile, nelems):
-    ctest_indexed_gzip.test_read_with_null_padding(testfile, nelems)
+def test_read_with_null_padding(testfile, nelems, use_mmap):
+    ctest_indexed_gzip.test_read_with_null_padding(testfile, nelems, use_mmap)
 
 def test_read_beyond_end(concat):
     ctest_indexed_gzip.test_read_beyond_end(concat, False)