Commit 735df6597f17e87ce27d81ad7fea159c68fbcab0

Authored by Jürgen Knödlseder
1 parent 3814d11a

Use "Exception as e" instead of "Exception, e" to make test scripts compatible with Python 3.

Note that this breaks compatibility with Python < 2.6.
test/test_ctbin.py
... ... @@ -83,7 +83,7 @@ class Test(gammalib.GPythonTestSuite):
83 83 try:
84 84 bin.run()
85 85 self.test_try_success()
86   - except Exception, e:
  86 + except Exception as e:
87 87 msg = "Exception occured in ctbin: %s." % (e,)
88 88 self.test_try_failure(msg)
89 89  
... ... @@ -92,7 +92,7 @@ class Test(gammalib.GPythonTestSuite):
92 92 try:
93 93 bin.save()
94 94 self.test_try_success()
95   - except Exception, e:
  95 + except Exception as e:
96 96 msg = "Exception occured in saving counts cube: %s." % (e,)
97 97 self.test_try_failure(msg)
98 98  
... ...
test/test_ctbkgcube.py
... ... @@ -91,7 +91,7 @@ class Test(gammalib.GPythonTestSuite):
91 91 try:
92 92 bkgcube.run()
93 93 self.test_try_success()
94   - except Exception, e:
  94 + except Exception as e:
95 95 msg = "Exception occured in ctbkgcube: %s." % (e,)
96 96 self.test_try_failure(msg)
97 97  
... ... @@ -100,7 +100,7 @@ class Test(gammalib.GPythonTestSuite):
100 100 try:
101 101 bkgcube.save()
102 102 self.test_try_success()
103   - except Exception, e:
  103 + except Exception as e:
104 104 msg = "Exception occured in saving background cube: %s." % (e,)
105 105 self.test_try_failure(msg)
106 106  
... ...
test/test_ctbutterfly.py
... ... @@ -81,7 +81,7 @@ class Test(gammalib.GPythonTestSuite):
81 81 try:
82 82 butterfly.run()
83 83 self.test_try_success()
84   - except Exception, e:
  84 + except Exception as e:
85 85 msg = "Exception occured in ctbutterfly: %s." % (e,)
86 86 self.test_try_failure(msg)
87 87  
... ... @@ -90,7 +90,7 @@ class Test(gammalib.GPythonTestSuite):
90 90 try:
91 91 butterfly.save()
92 92 self.test_try_success()
93   - except Exception, e:
  93 + except Exception as e:
94 94 msg = "Exception occured in saving butterfly diagram: %s." % (e,)
95 95 self.test_try_failure(msg)
96 96  
... ...
test/test_ctcubemask.py
... ... @@ -79,7 +79,7 @@ class Test(gammalib.GPythonTestSuite):
79 79 try:
80 80 mask.run()
81 81 self.test_try_success()
82   - except Exception, e:
  82 + except Exception as e:
83 83 msg = "Exception occured in ctcubemask: %s." % (e,)
84 84 self.test_try_failure(msg)
85 85  
... ... @@ -88,7 +88,7 @@ class Test(gammalib.GPythonTestSuite):
88 88 try:
89 89 mask.save()
90 90 self.test_try_success()
91   - except Exception, e:
  91 + except Exception as e:
92 92 msg = "Exception occured in saving counts cube: %s." % (e,)
93 93 self.test_try_failure(msg)
94 94  
... ...
test/test_cterror.py
... ... @@ -80,7 +80,7 @@ class Test(gammalib.GPythonTestSuite):
80 80 try:
81 81 error.run()
82 82 self.test_try_success()
83   - except Exception, e:
  83 + except Exception as e:
84 84 msg = "Exception occured in cterror: %s." % (e,)
85 85 self.test_try_failure(msg)
86 86  
... ... @@ -89,7 +89,7 @@ class Test(gammalib.GPythonTestSuite):
89 89 try:
90 90 error.save()
91 91 self.test_try_success()
92   - except Exception, e:
  92 + except Exception as e:
93 93 msg = "Exception occured in saving results: %s." % (e,)
94 94 self.test_try_failure(msg)
95 95  
... ...
test/test_ctexpcube.py
... ... @@ -88,7 +88,7 @@ class Test(gammalib.GPythonTestSuite):
88 88 try:
89 89 expcube.run()
90 90 self.test_try_success()
91   - except Exception, e:
  91 + except Exception as e:
92 92 msg = "Exception occured in ctexpcube: %s." % (e,)
93 93 self.test_try_failure(msg)
94 94  
... ... @@ -97,7 +97,7 @@ class Test(gammalib.GPythonTestSuite):
97 97 try:
98 98 expcube.save()
99 99 self.test_try_success()
100   - except Exception, e:
  100 + except Exception as e:
101 101 msg = "Exception occured in saving exposure cube: %s." % (e,)
102 102 self.test_try_failure(msg)
103 103  
... ...
test/test_ctlike.py
... ... @@ -78,7 +78,7 @@ class Test(gammalib.GPythonTestSuite):
78 78 try:
79 79 like.run()
80 80 self.test_try_success()
81   - except Exception, e:
  81 + except Exception as e:
82 82 msg = "Exception occured in ctlike: %s." % (e,)
83 83 self.test_try_failure(msg)
84 84  
... ... @@ -87,7 +87,7 @@ class Test(gammalib.GPythonTestSuite):
87 87 try:
88 88 like.save()
89 89 self.test_try_success()
90   - except Exception, e:
  90 + except Exception as e:
91 91 msg = "Exception occured in saving results: %s." % (e,)
92 92 self.test_try_failure(msg)
93 93  
... ...
test/test_ctmodel.py
... ... @@ -96,7 +96,7 @@ class Test(gammalib.GPythonTestSuite):
96 96 try:
97 97 model.run()
98 98 self.test_try_success()
99   - except Exception, e:
  99 + except Exception as e:
100 100 msg = "Exception occured in ctmodel: %s." % (e,)
101 101 self.test_try_failure(msg)
102 102  
... ... @@ -105,7 +105,7 @@ class Test(gammalib.GPythonTestSuite):
105 105 try:
106 106 model.save()
107 107 self.test_try_success()
108   - except Exception, e:
  108 + except Exception as e:
109 109 msg = "Exception occured in saving model cube: %s." % (e,)
110 110 self.test_try_failure(msg)
111 111  
... ...
test/test_ctobssim.py
... ... @@ -84,7 +84,7 @@ class Test(gammalib.GPythonTestSuite):
84 84 try:
85 85 sim.run()
86 86 self.test_try_success()
87   - except Exception, e:
  87 + except Exception as e:
88 88 msg = "Exception occured in ctobssim: %s." % (e,)
89 89 self.test_try_failure(msg)
90 90  
... ... @@ -105,7 +105,7 @@ class Test(gammalib.GPythonTestSuite):
105 105 try:
106 106 sim.save()
107 107 self.test_try_success()
108   - except Exception, e:
  108 + except Exception as e:
109 109 msg = "Exception occured in saving events: %s." % (e,)
110 110 self.test_try_failure(msg)
111 111  
... ... @@ -126,7 +126,7 @@ class Test(gammalib.GPythonTestSuite):
126 126 try:
127 127 sim.run()
128 128 self.test_try_success()
129   - except Exception, e:
  129 + except Exception as e:
130 130 msg = "Exception occured in ctobssim: %s." % (e,)
131 131 self.test_try_failure(msg)
132 132  
... ... @@ -138,7 +138,7 @@ class Test(gammalib.GPythonTestSuite):
138 138 try:
139 139 sim.save()
140 140 self.test_try_success()
141   - except Exception, e:
  141 + except Exception as e:
142 142 msg = "Exception occured in saving events: %s." % (e,)
143 143 self.test_try_failure(msg)
144 144  
... ...
test/test_ctpsfcube.py
... ... @@ -90,7 +90,7 @@ class Test(gammalib.GPythonTestSuite):
90 90 try:
91 91 psfcube.run()
92 92 self.test_try_success()
93   - except Exception, e:
  93 + except Exception as e:
94 94 msg = "Exception occured in ctpsfcube: %s." % (e,)
95 95 self.test_try_failure(msg)
96 96  
... ... @@ -99,7 +99,7 @@ class Test(gammalib.GPythonTestSuite):
99 99 try:
100 100 psfcube.save()
101 101 self.test_try_success()
102   - except Exception, e:
  102 + except Exception as e:
103 103 msg = "Exception occured in saving PSF cube: %s." % (e,)
104 104 self.test_try_failure(msg)
105 105  
... ...
test/test_ctselect.py
... ... @@ -79,7 +79,7 @@ class Test(gammalib.GPythonTestSuite):
79 79 try:
80 80 select.run()
81 81 self.test_try_success()
82   - except Exception, e:
  82 + except Exception as e:
83 83 msg = "Exception occured in ctselect: %s." % (e,)
84 84 self.test_try_failure(msg)
85 85  
... ... @@ -88,7 +88,7 @@ class Test(gammalib.GPythonTestSuite):
88 88 try:
89 89 select.save()
90 90 self.test_try_success()
91   - except Exception, e:
  91 + except Exception as e:
92 92 msg = "Exception occured in saving events: %s." % (e,)
93 93 self.test_try_failure(msg)
94 94  
... ...
test/test_ctskymap.py
... ... @@ -81,7 +81,7 @@ class Test(gammalib.GPythonTestSuite):
81 81 try:
82 82 skymap.run()
83 83 self.test_try_success()
84   - except Exception, e:
  84 + except Exception as e:
85 85 msg = "Exception occured in ctskymap: %s." % (e,)
86 86 self.test_try_failure(msg)
87 87  
... ... @@ -90,7 +90,7 @@ class Test(gammalib.GPythonTestSuite):
90 90 try:
91 91 skymap.save()
92 92 self.test_try_success()
93   - except Exception, e:
  93 + except Exception as e:
94 94 msg = "Exception occured in saving sky map: %s." % (e,)
95 95 self.test_try_failure(msg)
96 96  
... ...
test/test_cttsmap.py
... ... @@ -86,7 +86,7 @@ class Test(gammalib.GPythonTestSuite):
86 86 try:
87 87 tsmap.run()
88 88 self.test_try_success()
89   - except Exception, e:
  89 + except Exception as e:
90 90 msg = "Exception occured in cttsmap: %s." % (e,)
91 91 self.test_try_failure(msg)
92 92  
... ... @@ -95,7 +95,7 @@ class Test(gammalib.GPythonTestSuite):
95 95 try:
96 96 tsmap.save()
97 97 self.test_try_success()
98   - except Exception, e:
  98 + except Exception as e:
99 99 msg = "Exception occured in saving results: %s." % (e,)
100 100 self.test_try_failure(msg)
101 101  
... ...
test/test_ctulimit.py
... ... @@ -78,7 +78,7 @@ class Test(gammalib.GPythonTestSuite):
78 78 try:
79 79 ulimit.run()
80 80 self.test_try_success()
81   - except Exception, e:
  81 + except Exception as e:
82 82 msg = "Exception occured in ctulimit: %s." % (e,)
83 83 self.test_try_failure(msg)
84 84  
... ... @@ -87,7 +87,7 @@ class Test(gammalib.GPythonTestSuite):
87 87 try:
88 88 ulimit.save()
89 89 self.test_try_success()
90   - except Exception, e:
  90 + except Exception as e:
91 91 msg = "Exception occured in saving results: %s." % (e,)
92 92 self.test_try_failure(msg)
93 93  
... ...