diff --git a/cscripts/Makefile.am b/cscripts/Makefile.am index 24eaedd..e00e546 100644 --- a/cscripts/Makefile.am +++ b/cscripts/Makefile.am @@ -38,7 +38,7 @@ testdata = ../test/data/crab.xml \ ../test/data/exclusion.reg # Test IRFs to be distributed in $(pyexecdir)/cscripts/tests/irf -#testirf = +testirf = ../test/irf/irf_file.fits.gz # Distribute scripts and parfiles EXTRA_DIST = $(binscripts) $(pythonscripts) @@ -52,8 +52,8 @@ testscriptsdir = $(pyexecdir)/cscripts/tests testscripts_DATA = $(testscripts) testdatadir = $(pyexecdir)/cscripts/tests/data testdata_DATA = $(testdata) -#testirfdir = $(pyexecdir)/cscripts/tests/irf -#testirf_DATA = $(testirf) +testirfdir = $(pyexecdir)/cscripts/tests/irf +testirf_DATA = $(testirf) # Add hook rule to create symbolic links for cscripts install-data-hook: diff --git a/test/test_csobs2caldb.py b/test/test_csobs2caldb.py index 0b9646a..3a807e4 100755 --- a/test/test_csobs2caldb.py +++ b/test/test_csobs2caldb.py @@ -43,7 +43,7 @@ class Test(gammalib.GPythonTestSuite): gammalib.GPythonTestSuite.__init__(self) # Set members - self._inobs = "data/obs_unbinned.xml" + self._inobs = "data/obs_unbinned.xml" # Clean calibration database os.system("rm -rf caldb >/dev/null 2>&1") diff --git a/test/test_python_cscripts.py b/test/test_python_cscripts.py index a99940a..b824e2a 100755 --- a/test/test_python_cscripts.py +++ b/test/test_python_cscripts.py @@ -31,28 +31,10 @@ import test_cslightcrv # ================== # # Perform unit tests # # ================== # -def test(installed=False): +def test(installed=False, debug=False): """ Perform cscripts unit testing. """ - # Allocate test suite container - suites = gammalib.GTestSuites("cscripts unit testing") - - # Allocate test suites and append them to the container - suite_cscaldb = test_cscaldb.Test() - suite_csobs2caldb = test_csobs2caldb.Test() - suite_cslightcrv = test_cslightcrv.Test() - - # Setup unit tests - suite_cscaldb.set() - suite_csobs2caldb.set() - suite_cslightcrv.set() - - # Append tests to container - suites.append(suite_cscaldb) - suites.append(suite_csobs2caldb) - suites.append(suite_cslightcrv) - # If we have an installed version then create a temporary directory and # copy over all information that is needed if installed: @@ -69,7 +51,7 @@ def test(installed=False): # Copy over test data and irf os.system("cp -r %s %s" % (dirname+"/data", "data")) - #os.system("cp -r %s %s" % (dirname+"/irf", "irf")) + os.system("cp -r %s %s" % (dirname+"/irf", "irf")) # ... otherwise set the calibration database else: @@ -88,6 +70,24 @@ def test(installed=False): else: os.system("cp -r %s/syspfiles/*.par pfiles/" % (os.environ['CTOOLS'])) + # Allocate test suite container + suites = gammalib.GTestSuites("cscripts unit testing") + + # Allocate test suites and append them to the container + suite_cscaldb = test_cscaldb.Test() + suite_csobs2caldb = test_csobs2caldb.Test() + suite_cslightcrv = test_cslightcrv.Test() + + # Setup unit tests + suite_cscaldb.set() + suite_csobs2caldb.set() + suite_cslightcrv.set() + + # Append tests to container + suites.append(suite_cscaldb) + suites.append(suite_csobs2caldb) + suites.append(suite_cslightcrv) + # Run test suite success = suites.run() @@ -95,6 +95,10 @@ def test(installed=False): if not installed: suites.save("reports/cscripts.xml") + # If debuging is requested then print test suites + if debug: + print(suites) + # Set return code if success: rc = 0