diff --git a/test/test_ctbin.py b/test/test_ctbin.py index 3abdd03..29fcc1a 100755 --- a/test/test_ctbin.py +++ b/test/test_ctbin.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctbin tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -83,16 +83,18 @@ class Test(gammalib.GPythonTestSuite): try: bin.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctbin.") + except Exception, e: + msg = "Exception occured in ctbin: %s." % (e,) + self.test_try_failure(msg) # Save counts cube self.test_try("Save counts cube") try: bin.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving counts cube.") + except Exception, e: + msg = "Exception occured in saving counts cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctbkgcube.py b/test/test_ctbkgcube.py index df17278..6a1a2b4 100755 --- a/test/test_ctbkgcube.py +++ b/test/test_ctbkgcube.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctbkgcube tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -91,16 +91,18 @@ class Test(gammalib.GPythonTestSuite): try: bkgcube.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctbkgcube.") + except Exception, e: + msg = "Exception occured in ctbkgcube: %s." % (e,) + self.test_try_failure(msg) # Save background cube self.test_try("Save background cube") try: bkgcube.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving background cube.") + except Exception, e: + msg = "Exception occured in saving background cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctbutterfly.py b/test/test_ctbutterfly.py index ce148ac..18542ad 100755 --- a/test/test_ctbutterfly.py +++ b/test/test_ctbutterfly.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctbutterfly tool. # -# Copyright (C) 2014 Michal Mayer +# Copyright (C) 2014-2016 Michal Mayer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite): try: butterfly.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in butterfly.") + except Exception, e: + msg = "Exception occured in ctbutterfly: %s." % (e,) + self.test_try_failure(msg) # Save results self.test_try("Save results") try: butterfly.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving results.") + except Exception, e: + msg = "Exception occured in saving butterfly diagram: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctcubemask.py b/test/test_ctcubemask.py index 8b6f8e8..83c940c 100755 --- a/test/test_ctcubemask.py +++ b/test/test_ctcubemask.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctcubemask tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite): try: mask.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctcubemask.") + except Exception, e: + msg = "Exception occured in ctcubemask: %s." % (e,) + self.test_try_failure(msg) # Save counts cube self.test_try("Save counts cube") try: mask.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving counts cube.") + except Exception, e: + msg = "Exception occured in saving counts cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_cterror.py b/test/test_cterror.py index 2e90bef..f9774a6 100755 --- a/test/test_cterror.py +++ b/test/test_cterror.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the cterror tool. # -# Copyright (C) 2015 Florent Forest +# Copyright (C) 2015-2016 Florent Forest # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -80,16 +80,18 @@ class Test(gammalib.GPythonTestSuite): try: error.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in cterror.") + except Exception, e: + msg = "Exception occured in cterror: %s." % (e,) + self.test_try_failure(msg) # Save results self.test_try("Save results") try: error.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving results.") + except Exception, e: + msg = "Exception occured in saving results: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctexpcube.py b/test/test_ctexpcube.py index 2e98ff5..8995736 100755 --- a/test/test_ctexpcube.py +++ b/test/test_ctexpcube.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctexpcube tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -88,16 +88,18 @@ class Test(gammalib.GPythonTestSuite): try: expcube.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctexpcube.") + except Exception, e: + msg = "Exception occured in ctexpcube: %s." % (e,) + self.test_try_failure(msg) # Save exposure cube self.test_try("Save exposure cube") try: expcube.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving exposure cube.") + except Exception, e: + msg = "Exception occured in saving exposure cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctlike.py b/test/test_ctlike.py index 2912bbc..646fa2b 100755 --- a/test/test_ctlike.py +++ b/test/test_ctlike.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctlike tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite): try: like.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctlike.") + except Exception, e: + msg = "Exception occured in ctlike: %s." % (e,) + self.test_try_failure(msg) # Save results self.test_try("Save results") try: like.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving results.") + except Exception, e: + msg = "Exception occured in saving results: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctmodel.py b/test/test_ctmodel.py index 22581c0..c3b3dd5 100755 --- a/test/test_ctmodel.py +++ b/test/test_ctmodel.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctmodel tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -96,16 +96,18 @@ class Test(gammalib.GPythonTestSuite): try: model.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctmodel.") + except Exception, e: + msg = "Exception occured in ctmodel: %s." % (e,) + self.test_try_failure(msg) # Save counts cube self.test_try("Save model cube") try: model.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving model cube.") + except Exception, e: + msg = "Exception occured in saving model cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctobssim.py b/test/test_ctobssim.py index edc5b92..483cac4 100755 --- a/test/test_ctobssim.py +++ b/test/test_ctobssim.py @@ -84,8 +84,9 @@ class Test(gammalib.GPythonTestSuite): try: sim.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctobssim.") + except Exception, e: + msg = "Exception occured in ctobssim: %s." % (e,) + self.test_try_failure(msg) # Retrieve observation and check content obs = gammalib.GCTAObservation(sim.obs()[0]) @@ -104,8 +105,9 @@ class Test(gammalib.GPythonTestSuite): try: sim.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving events.") + except Exception, e: + msg = "Exception occured in saving events: %s." % (e,) + self.test_try_failure(msg) # Test ctobssim on observation container def test_container(self): @@ -124,8 +126,9 @@ class Test(gammalib.GPythonTestSuite): try: sim.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctobssim.") + except Exception, e: + msg = "Exception occured in ctobssim: %s." % (e,) + self.test_try_failure(msg) # Retrieve observation and check content self.test_value(sim.obs().size(), 4, "There are not 4 observations") @@ -135,8 +138,9 @@ class Test(gammalib.GPythonTestSuite): try: sim.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving events.") + except Exception, e: + msg = "Exception occured in saving events: %s." % (e,) + self.test_try_failure(msg) # Setup observation container def set_obs(self, number): diff --git a/test/test_ctpsfcube.py b/test/test_ctpsfcube.py index 15bf77f..bf6e500 100755 --- a/test/test_ctpsfcube.py +++ b/test/test_ctpsfcube.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctpsfcube tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -90,16 +90,18 @@ class Test(gammalib.GPythonTestSuite): try: psfcube.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctpsfcube.") + except Exception, e: + msg = "Exception occured in ctpsfcube: %s." % (e,) + self.test_try_failure(msg) # Save PSF cube self.test_try("Save PSF cube") try: psfcube.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving PSF cube.") + except Exception, e: + msg = "Exception occured in saving PSF cube: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctselect.py b/test/test_ctselect.py index b02237f..f4c7c7d 100755 --- a/test/test_ctselect.py +++ b/test/test_ctselect.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctselect tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -79,16 +79,18 @@ class Test(gammalib.GPythonTestSuite): try: select.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctselect.") + except Exception, e: + msg = "Exception occured in ctselect: %s." % (e,) + self.test_try_failure(msg) # Save events self.test_try("Save events") try: select.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving events.") + except Exception, e: + msg = "Exception occured in saving events: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctskymap.py b/test/test_ctskymap.py index bc557e2..c10a82a 100755 --- a/test/test_ctskymap.py +++ b/test/test_ctskymap.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctskymap tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -81,16 +81,18 @@ class Test(gammalib.GPythonTestSuite): try: skymap.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctskymap.") + except Exception, e: + msg = "Exception occured in ctskymap: %s." % (e,) + self.test_try_failure(msg) # Save counts cube self.test_try("Save sky map") try: skymap.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving sky map.") + except Exception, e: + msg = "Exception occured in saving sky map: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_cttsmap.py b/test/test_cttsmap.py index e78439b..41baf6c 100755 --- a/test/test_cttsmap.py +++ b/test/test_cttsmap.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the cttsmap tool. # -# Copyright (C) 2014 Juergen Knoedlseder +# Copyright (C) 2014-2016 Juergen Knoedlseder # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -86,16 +86,18 @@ class Test(gammalib.GPythonTestSuite): try: tsmap.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in cttsmap.") + except Exception, e: + msg = "Exception occured in cttsmap: %s." % (e,) + self.test_try_failure(msg) # Save results self.test_try("Save results") try: tsmap.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving results.") + except Exception, e: + msg = "Exception occured in saving results: %s." % (e,) + self.test_try_failure(msg) # Return return diff --git a/test/test_ctulimit.py b/test/test_ctulimit.py index 8deec9f..69a4d03 100755 --- a/test/test_ctulimit.py +++ b/test/test_ctulimit.py @@ -2,7 +2,7 @@ # ========================================================================== # This scripts performs unit tests for the ctulimit tool. # -# Copyright (C) 2015 Michael Mayer +# Copyright (C) 2015-2016 Michael Mayer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -78,16 +78,18 @@ class Test(gammalib.GPythonTestSuite): try: ulimit.run() self.test_try_success() - except: - self.test_try_failure("Exception occured in ctulimit.") + except Exception, e: + msg = "Exception occured in ctulimit: %s." % (e,) + self.test_try_failure(msg) # Save results self.test_try("Save results") try: ulimit.save() self.test_try_success() - except: - self.test_try_failure("Exception occured in saving results.") + except Exception, e: + msg = "Exception occured in saving results: %s." % (e,) + self.test_try_failure(msg) # Return return