tests: move auto source discovery test artifacts
[babeltrace.git] / tests / bindings / python / bt2 / test_trace_collection_message_iterator.py
index 64a974dc5e30d26b95bb080a6223a15a3ac16680..22de3f3641e57c8f45568459f853d7eb0802d826 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 datetime
 import bt2
@@ -6,9 +24,9 @@ import os.path
 
 
 _BT_CTF_TRACES_PATH = os.environ['BT_CTF_TRACES_PATH']
-_3EVENTS_INTERSECT_TRACE_PATH = os.path.join(_BT_CTF_TRACES_PATH,
-                                             'intersection',
-                                             '3eventsintersect')
+_3EVENTS_INTERSECT_TRACE_PATH = os.path.join(
+    _BT_CTF_TRACES_PATH, 'intersection', '3eventsintersect'
+)
 
 
 class ComponentSpecTestCase(unittest.TestCase):
@@ -20,7 +38,7 @@ class ComponentSpecTestCase(unittest.TestCase):
 
     def test_create_good_with_path_params(self):
         spec = bt2.ComponentSpec('plugin', 'compcls', 'a path')
-        self.assertEqual(spec.params['paths'], ['a path'])
+        self.assertEqual(spec.params['inputs'], ['a path'])
 
     def test_create_wrong_plugin_name_type(self):
         with self.assertRaises(TypeError):
@@ -37,6 +55,7 @@ class ComponentSpecTestCase(unittest.TestCase):
 
 # Return a map, msg type -> number of messages of this type.
 
+
 def _count_msgs_by_type(msgs):
     res = {}
 
@@ -70,7 +89,7 @@ class TraceCollectionMessageIteratorTestCase(unittest.TestCase):
     def test_create_no_such_plugin(self):
         specs = [bt2.ComponentSpec('77', '101', _3EVENTS_INTERSECT_TRACE_PATH)]
 
-        with self.assertRaises(bt2.Error):
+        with self.assertRaises(ValueError):
             bt2.TraceCollectionMessageIterator(specs)
 
     def test_create_begin_s(self):
@@ -93,40 +112,40 @@ class TraceCollectionMessageIteratorTestCase(unittest.TestCase):
         specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
         msg_iter = bt2.TraceCollectionMessageIterator(specs)
         msgs = list(msg_iter)
-        self.assertEqual(len(msgs), 32)
+        self.assertEqual(len(msgs), 28)
         hist = _count_msgs_by_type(msgs)
-        self.assertEqual(hist[bt2.message._EventMessage], 8)
+        self.assertEqual(hist[bt2._EventMessage], 8)
 
     # Same as the above, but we pass a single spec instead of a spec list.
     def test_iter_specs_not_list(self):
         spec = bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)
         msg_iter = bt2.TraceCollectionMessageIterator(spec)
         msgs = list(msg_iter)
-        self.assertEqual(len(msgs), 32)
+        self.assertEqual(len(msgs), 28)
         hist = _count_msgs_by_type(msgs)
-        self.assertEqual(hist[bt2.message._EventMessage], 8)
+        self.assertEqual(hist[bt2._EventMessage], 8)
 
     def test_iter_custom_filter(self):
         src_spec = bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)
-        flt_spec = bt2.ComponentSpec('utils', 'trimmer', {
-            'end': '13515309.000000075',
-        })
+        flt_spec = bt2.ComponentSpec('utils', 'trimmer', {'end': '13515309.000000075'})
         msg_iter = bt2.TraceCollectionMessageIterator(src_spec, flt_spec)
         hist = _count_msgs_by_type(msg_iter)
-        self.assertEqual(hist[bt2.message._EventMessage], 5)
+        self.assertEqual(hist[bt2._EventMessage], 5)
 
     def test_iter_intersection(self):
         specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
-        msg_iter = bt2.TraceCollectionMessageIterator(specs, stream_intersection_mode=True)
+        msg_iter = bt2.TraceCollectionMessageIterator(
+            specs, stream_intersection_mode=True
+        )
         msgs = list(msg_iter)
-        self.assertEqual(len(msgs), 19)
+        self.assertEqual(len(msgs), 15)
         hist = _count_msgs_by_type(msgs)
-        self.assertEqual(hist[bt2.message._EventMessage], 3)
+        self.assertEqual(hist[bt2._EventMessage], 3)
 
-    def test_iter_intersection_no_path_param(self):
+    def test_iter_intersection_no_inputs_param(self):
         specs = [bt2.ComponentSpec('text', 'dmesg', {'read-from-stdin': True})]
 
-        with self.assertRaises(bt2.Error):
+        with self.assertRaises(ValueError):
             bt2.TraceCollectionMessageIterator(specs, stream_intersection_mode=True)
 
     def test_iter_no_intersection_two_traces(self):
@@ -134,18 +153,18 @@ class TraceCollectionMessageIteratorTestCase(unittest.TestCase):
         specs = [spec, spec]
         msg_iter = bt2.TraceCollectionMessageIterator(specs)
         msgs = list(msg_iter)
-        self.assertEqual(len(msgs), 64)
+        self.assertEqual(len(msgs), 56)
         hist = _count_msgs_by_type(msgs)
-        self.assertEqual(hist[bt2.message._EventMessage], 16)
+        self.assertEqual(hist[bt2._EventMessage], 16)
 
     def test_iter_no_intersection_begin(self):
         specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
         msg_iter = bt2.TraceCollectionMessageIterator(specs, begin=13515309.000000023)
         hist = _count_msgs_by_type(msg_iter)
-        self.assertEqual(hist[bt2.message._EventMessage], 6)
+        self.assertEqual(hist[bt2._EventMessage], 6)
 
     def test_iter_no_intersection_end(self):
         specs = [bt2.ComponentSpec('ctf', 'fs', _3EVENTS_INTERSECT_TRACE_PATH)]
         msg_iter = bt2.TraceCollectionMessageIterator(specs, end=13515309.000000075)
         hist = _count_msgs_by_type(msg_iter)
-        self.assertEqual(hist[bt2.message._EventMessage], 5)
+        self.assertEqual(hist[bt2._EventMessage], 5)
This page took 0.025318 seconds and 4 git commands to generate.