project-gemmi / gemmi

macromolecular crystallography library and utilities
https://project-gemmi.github.io/
Mozilla Public License 2.0
231 stars 46 forks source link

1 test fails #291

Closed yurivict closed 10 months ago

yurivict commented 11 months ago
======================================================================
FAIL: test_sfcalc_1pfe (test_prog.TestProg)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/ports/science/py-gemmi/work-py39/gemmi-0.6.4/tests/test_prog.py", line 114, in test_sfcalc_1pfe
    self.do('''\
  File "/usr/ports/science/py-gemmi/work-py39/gemmi-0.6.4/tests/test_prog.py", line 45, in do
    self.assertEqual(expected_lines, output_lines)
AssertionError: Lists differ: ['RMSE=0.00054812  8.627e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.569e-06'] != ['RMSE=0.00054806  8.626e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.571e-06']

First differing element 0:
'RMSE=0.00054812  8.627e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.569e-06'
'RMSE=0.00054806  8.626e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.571e-06'

- ['RMSE=0.00054812  8.627e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.569e-06']
?                ^^      ^                                             ^^

+ ['RMSE=0.00054806  8.626e-05%  max|dF|=0.002943  R=0.000%  <dPhi>=3.571e-06']
?                ^^      ^                                             ^^

----------------------------------------------------------------------

Version: 0.6.4 Python-3.9 FreeBSD 13.2

wojdyr commented 10 months ago

I changed it, hopefully now it will pass.

I was aware that the tests may fail, sorry about it, and actually now they are also not guaranteed to pass. It's even more true about doctest tests in rst files. But there is no simple workaround for it other than removing such tests. It's much simpler to compare the output as text rather than to parse it and compare individual numbers. And although the tests are known to be flaky, AFAIK there is no way to mark a python test as "OK to fail".

Good to know this project is used also on FreeBSD.