Loosen error tolerance in test.

The PROPKA31 tests fail on Windows 10 Ubuntu 18.04 Windows Subsystem
Linux without any changes.  The relative error is less than 1e-3.  This
commit chnages the behavior to a test of absolute agreement to a test of
relative error less than 1e-3.
This commit is contained in:
Nathan Baker
2020-05-10 18:29:51 -07:00
parent 4fa015a54e
commit 997298f1f0

View File

@@ -4,6 +4,11 @@ import re
from subprocess import call from subprocess import call
import sys import sys
import unittest import unittest
import logging
ACCEPTABLE_ERROR = 0.001
# Setting this up as a direct translation of the original runtest.py script # Setting this up as a direct translation of the original runtest.py script
# that will be run as part of 'python setup.py test'. This takes on the # that will be run as part of 'python setup.py test'. This takes on the
@@ -53,8 +58,10 @@ class SystemTest(unittest.TestCase):
expected_value = float(ref.readline()) expected_value = float(ref.readline())
value = float(m.group(0)) value = float(m.group(0))
value_error = (value-expected_value)/expected_value
if(value != expected_value): if abs(value_error) > ACCEPTABLE_ERROR:
logging.error(value_error)
identity = line[:m.start()].strip() identity = line[:m.start()].strip()
errors.append("%12s %8.2f %8.2f" % errors.append("%12s %8.2f %8.2f" %
(identity, expected_value, value)) (identity, expected_value, value))