SmokinCaterpillar / pypet

The new python parameter exploration toolbox. pypet manages exploration of the parameter space and data storage into HDF5 files for you.
BSD 3-Clause "New" or "Revised" License
89 stars 22 forks source link

0.5.2 Python3.10: failing tests: FAILED (failures=11, skipped=10) #63

Closed sanjayankur31 closed 3 years ago

sanjayankur31 commented 3 years ago

We're seeing some tests fail while building 0.5.2 on Fedora 36 (rawhide) with Python 3.10.

Here are the ones failing---the LHS and RHS in assertions seem very similar so not sure what's happening here:

======================================================================
FAIL: test_expand (pypet.tests.integration.environment_test.EnvironmentTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 546, in test_expand
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>

======================================================================
FAIL: test_expand_after_reload (pypet.tests.integration.environment_test.EnvironmentTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 578, in test_expand_after_reload
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>

======================================================================
FAIL: test_run_complex (pypet.tests.integration.environment_test.EnvironmentTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 517, in test_run_complex
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.dia_mat: SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format> not equal to SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format>

======================================================================
FAIL: test_storage_and_loading (unittests.parameter_test.SparseParameterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/unittests/parameter_test.py", line 354, in test_storage_and_loading
    self.test_exploration()
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/unittests/parameter_test.py", line 313, in test_exploration
    self.assertTrue(np.all(str(val) == str(param_val)),'%s != %s'  %(str(val),str(param_val)))
AssertionError: False is not true :   (3, 3)    44.5 !=   (3, 2)        0.0

======================================================================
FAIL: test_store_load_with_hdf5 (unittests.parameter_test.SparseParameterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/unittests/parameter_test.py", line 52, in test_store_load_with_hdf5
    self.compare_trajectories(traj, new_traj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.MyName.Is.myParam.spsparse_dia: SparseParameter parameters.MyName.Is.myParam.spsparse_dia (len:9, `spsparse_dia`): <111x111 sparse matrix of type '<class 'numpy.float64'>'
        with 110 stored elements (1 diagonals) in DIAgonal format> not equal to SparseParameter parameters.MyName.Is.myParam.spsparse_dia (len:9, `spsparse_dia`): <111x111 sparse matrix of type '<class 'numpy.float64'>'
        with 110 stored elements (1 diagonals) in DIAgonal format>

======================================================================
FAIL: test_expand (pypet.tests.integration.environment_test.TestOtherHDF5Settings2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 546, in test_expand
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>

======================================================================
FAIL: test_expand_after_reload (pypet.tests.integration.environment_test.TestOtherHDF5Settings2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 578, in test_expand_after_reload
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>

======================================================================
FAIL: test_run_complex (pypet.tests.integration.environment_test.TestOtherHDF5Settings2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 517, in test_run_complex
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.dia_mat: SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format> not equal to SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format>

======================================================================
FAIL: test_expand (integration.environment_test.TestOtherHDF5Settings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 546, in test_expand
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>
Executing command `ptrepack -v --complib zlib --complevel 9 --shuffle 1 --fletcher32 0 /tmp/tmp_pypet_tests/hdf5compacting.hdf5 /tmp/tmp_pypet_tests/hdf5compacting_tmp.hdf5`
#### Compacting successful ####
Renaming files
### Compacting and Renaming finished ####

======================================================================
FAIL: test_expand_after_reload (integration.environment_test.TestOtherHDF5Settings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 578, in test_expand_after_reload
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.csr_mat: SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format> not equal to SparseParameter parameters.Sparse.csr_mat (len:8, `comment`): <222x22 sparse matrix of type '<class 'numpy.float64'>'
        with 2 stored elements in Compressed Sparse Row format>

======================================================================
FAIL: test_run_complex (integration.environment_test.TestOtherHDF5Settings)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/integration/environment_test.py", line 517, in test_run_complex
    self.compare_trajectories(self.traj, newtraj)
  File "/builddir/build/BUILDROOT/python-pypet-0.5.2-1.fc36.x86_64/usr/lib/python3.10/site-packages/pypet/tests/testutils/data.py", line 379, in compare_trajectories
    self.assertTrue(parameters_equal(item,old_item),
AssertionError: False is not true : For key parameters.Sparse.dia_mat: SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format> not equal to SparseParameter parameters.Sparse.dia_mat (len:3, `comment`): <4x4 sparse matrix of type '<class 'numpy.int64'>'
        with 9 stored elements (3 diagonals) in DIAgonal format>

----------------------------------------------------------------------
Ran 556 tests in 331.997s

FAILED (failures=11, skipped=10)

Here are the logs:

pypet-0.5.2-build.log.txt pypet-0.5.2-build.root.txt

SmokinCaterpillar commented 3 years ago

All of these seem to relate to scipy sparse matrices, what scipy version are you using?

sanjayankur31 commented 3 years ago

This is scipy 1.7.0 here now.

SmokinCaterpillar commented 3 years ago

Okay, this seems to be an issue with the new scipy sparse matrices rather than with Python 3.10

SmokinCaterpillar commented 3 years ago

Okay I fixed it by sacrificing human readability. Scipy Sparse Matrices are now stored using the save_npz function and hex concersion

SmokinCaterpillar commented 3 years ago

Okay merged into master, new release should be ready soon.