tests: don't test for specific device labels
[pygobject.git] / tests / test_thread.py
blob45ebd0b5c7c924a4c32369825f22179558ac6745
1 # -*- Mode: Python -*-
3 from __future__ import absolute_import
5 import unittest
7 from gi.repository import GLib
9 import testhelper
12 class TestThread(unittest.TestCase):
13 def setUp(self):
14 self.main = GLib.MainLoop()
15 self.called = False
17 def from_thread_cb(self, test, enum):
18 assert test == self.obj
19 assert int(enum) == 0
20 assert type(enum) != int
21 self.called = True
22 GLib.idle_add(self.timeout_cb)
24 def idle_cb(self):
25 self.obj = testhelper.get_test_thread()
26 self.obj.connect('from-thread', self.from_thread_cb)
27 self.obj.emit('emit-signal')
29 def test_extension_module(self):
30 GLib.idle_add(self.idle_cb)
31 GLib.timeout_add(2000, self.timeout_cb)
32 self.main.run()
33 self.assertTrue(self.called)
35 def timeout_cb(self):
36 self.main.quit()