From 997298f1f0894d96749cc7f76ddd012d957831c5 Mon Sep 17 00:00:00 2001 From: Nathan Baker Date: Sun, 10 May 2020 18:29:51 -0700 Subject: [PATCH] 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. --- Tests/pkacalc_test.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Tests/pkacalc_test.py b/Tests/pkacalc_test.py index 7eb0bd8..9f006d4 100644 --- a/Tests/pkacalc_test.py +++ b/Tests/pkacalc_test.py @@ -4,6 +4,11 @@ import re from subprocess import call import sys import unittest +import logging + + +ACCEPTABLE_ERROR = 0.001 + # 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 @@ -53,8 +58,10 @@ class SystemTest(unittest.TestCase): expected_value = float(ref.readline()) 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() errors.append("%12s %8.2f %8.2f" % (identity, expected_value, value))