Use Black stable to format python code
[babeltrace.git] / tests / bindings / python / bt2 / test_trace.py
index d4dca589367f91978299a52a6119a8de576a794c..d617539c280973f32b372800fa00cbb43a8f11eb 100644 (file)
@@ -1,20 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-only
 #
 # Copyright (C) 2019 EfficiOS Inc.
 #
-# 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 the Free Software Foundation; only version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-#
 
 import uuid
 import unittest
@@ -91,7 +78,7 @@ class TraceTestCase(unittest.TestCase):
             type(trace.environment['patate']), bt2_value._SignedIntegerValueConst
         )
 
-    def test_env_iter(self):
+    def test_const_env_iter(self):
         trace = utils.get_const_stream_beginning_message().stream.trace
         values = set(trace.environment)
         self.assertEqual(values, {'patate'})
@@ -168,9 +155,6 @@ class TraceTestCase(unittest.TestCase):
 
         trace.remove_destruction_listener(td_handle2)
 
-        del td_handle1
-        del td_handle2
-
         self.assertEqual(num_trace_class_destroyed_calls, 0)
         self.assertEqual(num_trace_destroyed_calls, 0)
 
@@ -235,6 +219,16 @@ class TraceTestCase(unittest.TestCase):
         ):
             trace.remove_destruction_listener(handle)
 
+    def test_raise_in_destruction_listener(self):
+        def on_trace_destruction(trace):
+            raise ValueError('it hurts')
+
+        trace_class = get_default_trace_class()
+        trace = trace_class()
+        trace.add_destruction_listener(on_trace_destruction)
+
+        del trace
+
 
 if __name__ == '__main__':
     unittest.main()
This page took 0.039854 seconds and 4 git commands to generate.