Skip to content

Commit

Permalink
refs #6667 Trying to add python library to test to python search path
Browse files Browse the repository at this point in the history
  • Loading branch information
abuts committed Jul 5, 2013
1 parent 92be120 commit 6257183
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 56 deletions.
6 changes: 4 additions & 2 deletions Code/Mantid/scripts/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
set ( TEST_PY_FILES
test/ReducerTest.py
# test/DgreduceTest.py
# test/DirectEnergyConversionTest.py
test/DgreduceTest.py
test/DirectEnergyConversionTest.py
)

# python unit tests
if (PYUNITTEST_FOUND)
pyunittest_add_test ( ${CMAKE_CURRENT_SOURCE_DIR}/test PythonScriptsTest ${TEST_PY_FILES} )
# Trying to add tested modules to python system path
set (PYTHON_LIBRARY ${PYTHON_LIBRARY} ${CMAKE_CURRENT_SOURCE_DIR}/Inelastic )
endif ()

# Ensure we don't get stale pyc files around
Expand Down
52 changes: 2 additions & 50 deletions Code/Mantid/scripts/Inelastic/dgreduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,60 +707,12 @@ def get_failed_spectra_list_from_masks(masking_wksp):



class DgreduceTest(unittest.TestCase):
def __init__(self, methodName):
setup("MAPS")
return super(DgreduceTest, self).__init__(methodName)

def setUp(self):
pass

def tearDown(self):
pass

def test_run_help(self):
self.assertRaises(ValueError,help,'rubbish')
help("monovan_lo_bound")
def test_process_legacy_parameters(self):
kw=dict();
kw["hardmaskOnly"]="someFileName"
kw["someKeyword"] ="aaaa"
kw["normalise_method"] ="Monitor-1"
params = process_legacy_parameters(**kw);
self.assertEqual(len(params),4)
self.assertTrue("someKeyword" in params);
self.assertTrue("hard_mask_file" in params);
self.assertTrue("use_hard_mask_only" in params)
self.assertEqual(params['normalise_method'],'monitor-1')

def test_setup(self):

setup('mari')
self.assertTrue(not (Reducer is None))

self.assertEqual(Reducer.instr_name,'MAR')

Reducer.save_format = ''
self.assertTrue(Reducer.save_format is None)

Reducer.save_format = 'none'
self.assertTrue(Reducer.save_format is None)

Reducer.save_format = []
self.assertTrue(Reducer.save_format is None)

def test_setup_empty(self):
# clear up singleton
global Reducer
Reducer = None


setup(None)



if __name__=="__main__":
unittest.main()
pass
# unittest.main()



Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/scripts/test/DgreduceTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,6 @@ def test_setup_empty(self):


setup(None)

if __name__=="__main__":
unittest.main()
6 changes: 2 additions & 4 deletions Code/Mantid/scripts/test/DirectEnergyConversionTest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import CommonFunctions as common
import diagnostics
from mantid.simpleapi import *
from mantid.kernel import funcreturns
import DirectEnergyConversion
import unittest

Expand Down Expand Up @@ -222,3 +218,5 @@ def test_do_white(self) :
# tReducer.initialise("MAP")

# tReducet.di


0 comments on commit 6257183

Please sign in to comment.