HadrienG / InSilicoSeq

:rocket: A sequencing simulator
https://insilicoseq.readthedocs.io
MIT License
176 stars 32 forks source link

test failure with numpy 1.23.5 #229

Closed emollier closed 10 months ago

emollier commented 1 year ago

Good day,

For information, Paul Gevers noticed in Debian bug #1026344 that the InSilicoSeq test item _test_bad_errmod fails when running against numpy 1.23.5 while testing against numpy 1.21.5 works fine. Relevant sections of the test log are:

The above exception was the direct cause of the following exception:

    def test_bad_err_mod():
        with pytest.raises(SystemExit):
>           err_mod = kde.KDErrorModel('data/empty_file')

test/test_error_model.py:93: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/iss/error_models/kde.py:34: in __init__
    self.error_profile = self.load_npz(npz_path, 'kde')
/usr/lib/python3/dist-packages/iss/error_models/__init__.py:37: in load_npz
    error_profile = np.load(npz_path, allow_pickle=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[...]
E                   _pickle.UnpicklingError: Failed to interpret file 'data/empty_file' as a pickle

The patch below fixes/works around the test failure, but I'm not 100% sure this is in the spirit of the test:

--- insilicoseq.orig/iss/test/test_error_model.py
+++ insilicoseq/iss/test/test_error_model.py
@@ -9,6 +9,7 @@

 import random
 import numpy as np
+import _pickle

 def test_perfect_phred():
@@ -89,5 +90,5 @@

 def test_bad_err_mod():
-    with pytest.raises(SystemExit):
+    with pytest.raises((SystemExit, _pickle.UnpicklingError,)):
         err_mod = kde.KDErrorModel('data/empty_file')

Anyway, in hope this helps, Étienne.

HadrienG commented 10 months ago

Thanks! will be fixed in 1.6.0