Skip to content

Commit f43e655

Browse files
authored
[Sibling] Restore PowderReduceP2DTest (#39098)
1 parent 0f69d9a commit f43e655

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

Testing/SystemTests/tests/framework/PowderReduceP2DTest.py

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@
44
# NScD Oak Ridge National Laboratory, European Spallation Source,
55
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
66
# SPDX - License - Identifier: GPL - 3.0 +
7-
import systemtesting
87
from mantid.simpleapi import PowderReduceP2D
8+
from mantid.api import FileFinder
99

10+
import numpy as np
11+
import os
1012
import sys
13+
import systemtesting
1114

1215

1316
class PowderReduceP2DTest(systemtesting.MantidSystemTest):
@@ -16,11 +19,6 @@ def __init__(self):
1619
self.tolerance = 1e-6
1720
self.setUp()
1821

19-
def skipTests(self):
20-
# Now working on macOS but producing different outputs on windows.
21-
# Skipped while investigation continues.
22-
return sys.platform.startswith("win")
23-
2422
def setUp(self):
2523
self.sample = self._sampleEventData()
2624
self.vana = self._vanadiumEventData()
@@ -67,11 +65,23 @@ def runTest(self):
6765
SystemTest=True,
6866
)
6967

70-
def validateMethod(self):
71-
return "ValidateAscii"
68+
def doValidation(self):
69+
"""Overrides validation to handle .p2d file with tolerances"""
70+
measured = f"{self.outputFile}.p2d"
71+
expected = self.reference
72+
73+
if not os.path.isabs(measured):
74+
measured = FileFinder.Instance().getFullPath(measured)
75+
if not os.path.isabs(expected):
76+
expected = FileFinder.Instance().getFullPath(expected)
77+
78+
np_measured = np.loadtxt(measured)
79+
np_expected = np.loadtxt(expected)
80+
81+
np.testing.assert_allclose(np_measured, np_expected, atol=0.25, rtol=0.65)
7282

73-
def validate(self):
74-
return self.outputFile + ".p2d", self.reference
83+
# testing passed if this is reached
84+
return True
7585

7686
def _sampleEventData(self):
7787
"""path to sample event data used for testing the algorithm"""

0 commit comments

Comments
 (0)