Commit 0e7be17f authored by Thomas Vincent's avatar Thomas Vincent

less constrained fit testing on windows

parent 88044840
......@@ -33,6 +33,7 @@ __date__ = "05/01/2016"
import os
import shutil
import sys
import tempfile
import unittest
......@@ -46,19 +47,14 @@ from xsocs.process.fit.peak_fit import PeakFitter
from xsocs.io.FitH5 import FitH5
# ==============================================================
# ==============================================================
# ==============================================================
def _cmp_fit_h5_files(test_case, ref_h5, this_h5):
"""
Compares two FitH5 files.
"""Compares two FitH5 files.
:param test_case:
:param ref_h5:
:param this_h5:
:return:
"""
ref_entries = ref_h5.entries()
this_entries = this_h5.entries()
......@@ -69,15 +65,14 @@ def _cmp_fit_h5_files(test_case, ref_h5, this_h5):
def _cmp_fit_h5_processes(test_case, ref_h5, this_h5, entry):
"""
Compares two FitH5 files
"""Compares two FitH5 files
:param test_case:
:param ref_h5:
:param this_h5:
:param entry:
:return:
"""
ref_processes = ref_h5.processes(entry)
this_processes = this_h5.processes(entry)
test_case.assertEqual(ref_processes, this_processes)
......@@ -95,8 +90,8 @@ def _cmp_fit_h5_results(test_case,
this_h5,
entry,
process):
"""
Compares two FitH5 files
"""Compares two FitH5 files
:param test_case:
:param ref_h5:
:param this_h5:
......@@ -104,7 +99,6 @@ def _cmp_fit_h5_results(test_case,
:param process:
:return:
"""
ref_results = ref_h5.get_result_names(
entry, process)
this_results = this_h5.get_result_names(
......@@ -115,7 +109,11 @@ def _cmp_fit_h5_results(test_case,
for result in ref_results:
ref_qx = ref_h5.get_qx_result(entry, process, result)
this_qx = this_h5.get_qx_result(entry, process, result)
test_case.assertTrue(np.array_equal(ref_qx, this_qx))
if sys.platform == 'win32':
# Relax tests on Windows
test_case.assertTrue(np.allclose(ref_qx, this_qx))
else:
test_case.assertTrue(np.array_equal(ref_qx, this_qx))
ref_qy = ref_h5.get_qy_result(entry, process, result)
this_qy = this_h5.get_qy_result(entry, process, result)
......@@ -127,9 +125,7 @@ def _cmp_fit_h5_results(test_case,
class TestPeakFitter(ParametricTestCase):
"""
Unit tests of the qspace converter class.
"""
"""Unit tests of the qspace converter class."""
@classmethod
def setUpClass(cls):
......@@ -155,9 +151,6 @@ class TestPeakFitter(ParametricTestCase):
self._tmpTestDir = None
def test_nominal(self):
"""
"""
manager = self._manager
keys = ['fit_f', 'qspace_f']
......@@ -198,21 +191,11 @@ class TestPeakFitter(ParametricTestCase):
_cmp_fit_h5_files(self, fit_ref_h5, fit_out_h5)
# ==============================================================
# ==============================================================
# ==============================================================
test_cases = (TestPeakFitter
,)
def suite():
loader = unittest.defaultTestLoader
test_suite = unittest.TestSuite()
for test_class in test_cases:
tests = loader.loadTestsFromTestCase(test_class)
test_suite.addTests(tests)
test_suite.addTests(
loader.loadTestsFromTestCase(TestPeakFitter))
return test_suite
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment