Commit 6f01c824 authored by Conor Finn's avatar Conor Finn
Browse files

Move ILL data directory setups to class setup

A lot of the ILL tests were using the appendDataSearchSubDir method in
the setup functions. This was resulting in many directories being added
to the config service as the tests ran. They have now been moved to the
setUpClass functions or constructors so they are only added once.

RE #28499
parent 6a08675e
......@@ -31,10 +31,12 @@ public:
}
static void destroySuite(LoadILLDiffractionTest *suite) { delete suite; }
void setUp() override {
LoadILLDiffractionTest() {
ConfigService::Instance().appendDataSearchSubDir("ILL/D20/");
ConfigService::Instance().appendDataSearchSubDir("ILL/D2B/");
}
void setUp() override {
m_oldFacility = ConfigService::Instance().getFacility().name();
ConfigService::Instance().setFacility("ILL");
......
......@@ -37,7 +37,13 @@ public:
static LoadILLSANSTest *createSuite() { return new LoadILLSANSTest(); }
static void destroySuite(LoadILLSANSTest *suite) { delete suite; }
void setUp() override { ConfigService::Instance().setFacility("ILL"); }
LoadILLSANSTest() {
ConfigService::Instance().appendDataSearchSubDir("ILL/D11/");
ConfigService::Instance().appendDataSearchSubDir("ILL/D22/");
ConfigService::Instance().appendDataSearchSubDir("ILL/D33/");
ConfigService::Instance().appendDataSearchSubDir("ILL/D16/");
ConfigService::Instance().setFacility("ILL");
}
void tearDown() override { AnalysisDataService::Instance().clear(); }
......
......@@ -11,11 +11,14 @@ from mantid.simpleapi import LoadAndMerge, config, mtd
class LoadAndMergeTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
config.appendDataSearchSubDir('ILL/IN16B/')
config.appendDataSearchSubDir('ILL/D20/')
def setUp(self):
config['default.facility'] = 'ILL'
config['default.instrument'] = 'IN16B'
config.appendDataSearchSubDir('ILL/IN16B/')
config.appendDataSearchSubDir('ILL/D20/')
def test_single_run_load(self):
out1 = LoadAndMerge(Filename='170257')
......
......@@ -10,7 +10,8 @@ import unittest
class LoadLampTest(unittest.TestCase):
def setUp(self):
@classmethod
def setUpClass(cls):
config.appendDataSearchSubDir('ILL/LAMP/')
def tearDown(self):
......
......@@ -13,10 +13,13 @@ from mantid.simpleapi import PowderILLDetectorScan, config, mtd
# More options are covered by system tests, since it takes too long for a unit test.
class PowderILLDetectorScanTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
config.appendDataSearchSubDir('ILL/D2B/')
def setUp(self):
config['default.facility'] = 'ILL'
config['default.instrument'] = 'D2B'
config.appendDataSearchSubDir('ILL/D2B/')
def tearDown(self):
mtd.clear()
......
......@@ -13,10 +13,13 @@ class PowderILLParameterScanTest(unittest.TestCase):
_runs = '967087:967088'
@classmethod
def setUpClass(cls):
config.appendDataSearchSubDir('ILL/D20/')
def setUp(self):
config['default.facility'] = 'ILL'
config['default.instrument'] = 'D20'
config.appendDataSearchSubDir('ILL/D20/')
def tearDown(self):
mtd.remove('red')
......
......@@ -15,10 +15,12 @@ class SANSILLReductionTest(unittest.TestCase):
_facility = None
_instrument = None
def setUp(self):
@classmethod
def setUpClass(cls):
config.appendDataSearchSubDir('ILL/D11/')
config.appendDataSearchSubDir('ILL/D33/')
def setUp(self):
self._facility = config['default.facility']
self._instrument = config['default.instrument']
......
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