lib: make packets and packet messages optional, disabled by default
[babeltrace.git] / tests / bindings / python / bt2 / test_clock_class.py
index de0c001c6d6b11235812b8518f2021ff51464617..53487c655370a9695064eba568894489f33832ac 100644 (file)
@@ -1,3 +1,21 @@
+#
+# 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 unittest
 import uuid
 import copy
@@ -161,7 +179,7 @@ class ClockClassTestCase(unittest.TestCase):
             return comp_self._create_clock_class(frequency=1000)
 
         cc = run_in_component_init(f)
-        with self.assertRaises(OverflowError):
+        with self.assertRaises(bt2.OverflowError):
             cc.cycles_to_ns_from_origin(2**63)
 
     def test_create_uuid(self):
@@ -189,33 +207,25 @@ class ClockSnapshotTestCase(unittest.TestCase):
 
         _cc, _tc = run_in_component_init(f)
         _trace = _tc()
-        _sc = _tc.create_stream_class(default_clock_class=_cc,
-                                      packets_have_default_beginning_clock_snapshot=True,
-                                      packets_have_default_end_clock_snapshot=True)
+        _sc = _tc.create_stream_class(default_clock_class=_cc)
         _ec = _sc.create_event_class(name='salut')
         _stream = _trace.create_stream(_sc)
-        _packet = _stream.create_packet()
-        self._packet = _packet
         self._stream = _stream
         self._ec = _ec
         self._cc = _cc
 
         class MyIter(bt2._UserMessageIterator):
-            def __init__(self):
+            def __init__(self, self_port_output):
                 self._at = 0
 
             def __next__(self):
                 if self._at == 0:
                     notif = self._create_stream_beginning_message(_stream)
                 elif self._at == 1:
-                    notif = self._create_packet_beginning_message(_packet, 100)
+                    notif = self._create_event_message(_ec, _stream, 123)
                 elif self._at == 2:
-                    notif = self._create_event_message(_ec, _packet, 123)
+                    notif = self._create_event_message(_ec, _stream, 2**63)
                 elif self._at == 3:
-                    notif = self._create_event_message(_ec, _packet, 2**63)
-                elif self._at == 4:
-                    notif = self._create_packet_end_message(_packet)
-                elif self._at == 5:
                     notif = self._create_stream_end_message(_stream)
                 else:
                     raise bt2.Stop
@@ -233,9 +243,9 @@ class ClockSnapshotTestCase(unittest.TestCase):
             self._src_comp.output_ports['out'])
 
         for i, msg in enumerate(self._msg_iter):
-            if i == 2:
+            if i == 1:
                 self._msg = msg
-            elif i == 3:
+            elif i == 2:
                 self._msg_clock_overflow = msg
                 break
 
@@ -259,7 +269,7 @@ class ClockSnapshotTestCase(unittest.TestCase):
             self._msg.default_clock_snapshot.ns_from_origin, ns_from_origin)
 
     def test_ns_from_origin_overflow(self):
-        with self.assertRaises(OverflowError):
+        with self.assertRaises(bt2.OverflowError):
             self._msg_clock_overflow.default_clock_snapshot.ns_from_origin
 
     def test_eq_int(self):
This page took 0.024181 seconds and 4 git commands to generate.