pymatgen icon indicating copy to clipboard operation
pymatgen copied to clipboard

defects test_generators fails on non-amd64 architecture

Open drew-parsons opened this issue 4 years ago • 0 comments

Describe the bug

The test suite includes VoronoiInterstitialGeneratorTest.test_int_gen in pymatgen/analysis/defects/tests/test_generators.py, https://github.com/materialsproject/pymatgen/blob/fffcc6d3edf95132fbf910ddc520d00309f1b448/pymatgen/analysis/defects/tests/test_generators.py#L107

This test run at build-time is failing any many non-amd64 architectures, e.g. for arm64, https://buildd.debian.org/status/fetch.php?pkg=pymatgen&arch=arm64&ver=2022.0.11%2Bdfsg1-1&stamp=1633948064&raw=0

________________ VoronoiInterstitialGeneratorTest.test_int_gen _________________

self = <defects.tests.test_generators.VoronoiInterstitialGeneratorTest testMethod=test_int_gen>

    def test_int_gen(self):
        struc = PymatgenTest.get_structure("VO2")
        int_gen = VoronoiInterstitialGenerator(struc, "Li")
    
        ints = list(int_gen)
        self.assertEqual(len(ints), 3)
    
        multiplicities = [i.multiplicity for i in ints]
        self.assertEqual(multiplicities, [8, 8, 4])
    
        self.assertEqual(str(ints[0].site.specie), "Li")
        self.assertEqual(str(ints[1].site.specie), "Li")
        self.assertEqual(str(ints[2].site.specie), "Li")
        # self.assertEqual(str(ints[3].site.specie), "Li")
    
>       self.assertArrayAlmostEqual(ints[0].site.coords, (1.5177146, 2.6784354, 3.9481299))

.pybuild/test_python3.9/pymatgen/analysis/defects/tests/test_generators.py:107: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

actual = array([1.5177146 , 3.94812992, 2.67843543])
desired = (1.5177146, 2.6784354, 3.9481299), decimal = 7, err_msg = ''
verbose = True

    @staticmethod
    def assertArrayAlmostEqual(actual, desired, decimal=7, err_msg="", verbose=True):
        """
        Tests if two arrays are almost equal to a tolerance. The CamelCase
        naming is so that it is consistent with standard unittest methods.
        """
>       return nptu.assert_almost_equal(actual, desired, decimal, err_msg, verbose)
E       AssertionError: 
E       Arrays are not almost equal to 7 decimals
E       
E       Mismatched elements: 2 / 3 (66.7%)
E       Max absolute difference: 1.26969452
E       Max relative difference: 0.47404336
E        x: array([1.5177146, 3.9481299, 2.6784354])
E        y: array([1.5177146, 2.6784354, 3.9481299])

.pybuild/test_python3.9/pymatgen/util/testing.py:82: AssertionError

Not all non-amd64 architectures fail. mipsel and armel pass. arm64 and ppc64el fail. A list of failing builds and build logs can be found at https://buildd.debian.org/status/package.php?p=pymatgen

To Reproduce Steps to reproduce the behavior:

  1. Build pymatgen on non-amd64 hardware, e.g. arm64
  2. Prepare test_files dir e.g. from the source dir, with the compiled module installed to pybuilddir
testdir=build/test_py
mkdir -p $testdir
cp -a $pybuilddir $testdir
for t in `find pymatgen -name tests`; do
      d=`dirname $t`;
      cp -a $t $testdir/$d;
done
PMG_TEST_FILES_DIR=`pwd`/test_files PYTHONPATH=$testdir pytest-3 -v  $testdir;
  1. Launch tests
PMG_TEST_FILES_DIR=`pwd`/test_files pytest-3 -v $TESTDIR
  1. See error

Expected behavior

The tests should pass on all architectures.

Desktop (please complete the following information):

  • OS: Debian GNU/Linux (debian unstable)
  • Version 2022.0.11

drew-parsons avatar Oct 13 '21 07:10 drew-parsons