Commit 8bf51e07 authored by Srikanth Ravipati's avatar Srikanth Ravipati Committed by Peterson, Peter
Browse files

Updated set and unset facility

parent 74ad9d2c
...@@ -57,6 +57,7 @@ class MuonFileUtilsTest(unittest.TestCase): ...@@ -57,6 +57,7 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(instrument, 'MUSR') self.assertEqual(instrument, 'MUSR')
def test_that_load_dead_time_from_filename_places_table_in_ADS(self): def test_that_load_dead_time_from_filename_places_table_in_ADS(self):
ConfigService["default.facility"] = "ISIS"
filename = 'MUSR00022725.nsx' filename = 'MUSR00022725.nsx'
name = utils.load_dead_time_from_filename(filename) name = utils.load_dead_time_from_filename(filename)
...@@ -64,8 +65,10 @@ class MuonFileUtilsTest(unittest.TestCase): ...@@ -64,8 +65,10 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(name, 'MUSR00022725.nsx_deadtime_table') self.assertEqual(name, 'MUSR00022725.nsx_deadtime_table')
self.assertTrue(isinstance(dead_time_table, ITableWorkspace)) self.assertTrue(isinstance(dead_time_table, ITableWorkspace))
ConfigService["default.facility"] = "NONE"
def test_load_workspace_from_filename_for_existing_file(self): def test_load_workspace_from_filename_for_existing_file(self):
ConfigService["default.facility"] = "ISIS"
filename = 'MUSR00022725.nsx' filename = 'MUSR00022725.nsx'
load_result, run, filename, _ = utils.load_workspace_from_filename(filename) load_result, run, filename, _ = utils.load_workspace_from_filename(filename)
...@@ -74,6 +77,7 @@ class MuonFileUtilsTest(unittest.TestCase): ...@@ -74,6 +77,7 @@ class MuonFileUtilsTest(unittest.TestCase):
self.assertEqual(load_result['MainFieldDirection'], 'Transverse') self.assertEqual(load_result['MainFieldDirection'], 'Transverse')
self.assertAlmostEqual(load_result['TimeZero'], 0.55000, 5) self.assertAlmostEqual(load_result['TimeZero'], 0.55000, 5)
self.assertEqual(run, 22725) self.assertEqual(run, 22725)
ConfigService["default.facility"] = "NONE"
def test_load_workspace_from_filename_for_file_path(self): def test_load_workspace_from_filename_for_file_path(self):
filename = 'PSI'+ os.sep + 'run_1529_templs0.mon' filename = 'PSI'+ os.sep + 'run_1529_templs0.mon'
...@@ -84,8 +88,5 @@ class MuonFileUtilsTest(unittest.TestCase): ...@@ -84,8 +88,5 @@ class MuonFileUtilsTest(unittest.TestCase):
alg, _ = utils.create_load_algorithm(filename,inputs) alg, _ = utils.create_load_algorithm(filename,inputs)
self.assertTrue(filename in alg.getProperty("Filename").value) self.assertTrue(filename in alg.getProperty("Filename").value)
if __name__ == '__main__': if __name__ == '__main__':
ConfigService.setFacility("ISIS") unittest.main(buffer=False, verbosity=2)
unittest.main(buffer=False, verbosity=2) \ No newline at end of file
ConfigService.setFacility("NONE")
...@@ -20,7 +20,9 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase): ...@@ -20,7 +20,9 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase):
super(ReflectometryQuickAuxiliaryTest, self).__init__(methodName) super(ReflectometryQuickAuxiliaryTest, self).__init__(methodName)
def setUp(self): def setUp(self):
config.setString("default.facility", "ISIS")
LoadISISNexus(Filename='POLREF00004699', OutputWorkspace=self.__wsName) LoadISISNexus(Filename='POLREF00004699', OutputWorkspace=self.__wsName)
config.setString("default.facility", "NONE")
def tearDown(self): def tearDown(self):
DeleteWorkspace(mtd[self.__wsName]) DeleteWorkspace(mtd[self.__wsName])
...@@ -132,6 +134,4 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase): ...@@ -132,6 +134,4 @@ class ReflectometryQuickAuxiliaryTest(unittest.TestCase):
if __name__ == '__main__': if __name__ == '__main__':
config.setFacility("ISIS")
unittest.main() unittest.main()
config.setFacility("NONE")
...@@ -34,7 +34,9 @@ class CalculateTransmissionHelperTest(unittest.TestCase): ...@@ -34,7 +34,9 @@ class CalculateTransmissionHelperTest(unittest.TestCase):
@staticmethod @staticmethod
def _create_flat_background_test_workspace(workspace_name): def _create_flat_background_test_workspace(workspace_name):
config.setString("default.facility", "ISIS")
LoadNexusProcessed(Filename="LOQ48127", OutputWorkspace=workspace_name) LoadNexusProcessed(Filename="LOQ48127", OutputWorkspace=workspace_name)
config.setString("default.facility", "NONE")
workspace = AnalysisDataService.retrieve(workspace_name) workspace = AnalysisDataService.retrieve(workspace_name)
# Rebin to only have four values at 11, 31, 51, 70.5 # Rebin to only have four values at 11, 31, 51, 70.5
workspace = Rebin(workspace, "1,20,80") workspace = Rebin(workspace, "1,20,80")
...@@ -61,6 +63,7 @@ class CalculateTransmissionHelperTest(unittest.TestCase): ...@@ -61,6 +63,7 @@ class CalculateTransmissionHelperTest(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
config.setString("default.facility", "ISIS")
# A small workspace for general tests # A small workspace for general tests
test_workspace = LoadNexusProcessed(Filename="LOQ48127") test_workspace = LoadNexusProcessed(Filename="LOQ48127")
cls.immutable_test_workspace = test_workspace cls.immutable_test_workspace = test_workspace
...@@ -88,6 +91,7 @@ class CalculateTransmissionHelperTest(unittest.TestCase): ...@@ -88,6 +91,7 @@ class CalculateTransmissionHelperTest(unittest.TestCase):
"\t</detector-masking>\n") "\t</detector-masking>\n")
cls.mask_file_path = cls._get_path(cls.mask_file) cls.mask_file_path = cls._get_path(cls.mask_file)
cls._save_file(cls.mask_file_path, mask_content) cls._save_file(cls.mask_file_path, mask_content)
config.setString("default.facility", "NONE")
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
...@@ -234,6 +238,4 @@ class CalculateTransmissionHelperTest(unittest.TestCase): ...@@ -234,6 +238,4 @@ class CalculateTransmissionHelperTest(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
config.setFacility("ISIS")
unittest.main() unittest.main()
config.setFacility("NONE")
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