[tracker/sam/functional-test-fixes: 7/20] functional-tests: Replace use of PyGObject with PyGI



commit 004a040db18c613e8ddc09cb5fdb02f9788c9902
Author: Sam Thursfield <sam afuera me uk>
Date:   Sun Jul 20 12:12:18 2014 +0100

    functional-tests: Replace use of PyGObject with PyGI
    
    If we do 'import gobject' anywhere then we cannot use the new
    GObject-introspection based Python bindings, because they conflict.
    This change means the functional tests can now use PyGI.
    
    Note that the dbus-python bindings are still widely used in the
    functional-tests. That doesn't seem to cause any conflicts, but it
    would be good to use the more modern GDBus through PyGI one day.

 tests/functional-tests/09-concurrent-query.py     |    6 +++---
 tests/functional-tests/10-sqlite-misused.py       |    8 ++++----
 tests/functional-tests/11-sqlite-batch-misused.py |    8 ++++----
 tests/functional-tests/13-threaded-store.py       |    4 ++--
 tests/functional-tests/14-signals.py              |    4 ++--
 tests/functional-tests/common/utils/helpers.py    |    4 ++--
 tests/functional-tests/common/utils/system.py     |    6 +++---
 tests/functional-tests/fts-tc.py                  |    4 ++--
 tests/functional-tests/mass-storage-mode.py       |    4 ++--
 9 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/tests/functional-tests/09-concurrent-query.py b/tests/functional-tests/09-concurrent-query.py
index 4cc626e..652d428 100755
--- a/tests/functional-tests/09-concurrent-query.py
+++ b/tests/functional-tests/09-concurrent-query.py
@@ -26,7 +26,7 @@ import time
 import random
 import commands
 import signal
-import gobject
+from gi.repository import GObject
 from dbus.mainloop.glib import DBusGMainLoop
 
 from common.utils import configuration as cfg
@@ -43,7 +43,7 @@ class TestConcurrentQuery (CommonTrackerStoreTest):
     holding those queries
     """
     def setUp (self):
-        self.main_loop = gobject.MainLoop ()
+        self.main_loop = GObject.MainLoop ()
         
         self.mock_data_insert ()
         self.finish_counter = 0
@@ -81,7 +81,7 @@ class TestConcurrentQuery (CommonTrackerStoreTest):
                                                             error_handler=self.error_handler)
             
         # Safeguard of 50 seconds. The last reply should quit the loop
-        gobject.timeout_add_seconds (60, self.timeout_cb)
+        GObject.timeout_add_seconds (60, self.timeout_cb)
         self.main_loop.run ()
         
     def reply_cb (self, results):
diff --git a/tests/functional-tests/10-sqlite-misused.py b/tests/functional-tests/10-sqlite-misused.py
index 0e7f1ec..f1b8ca7 100755
--- a/tests/functional-tests/10-sqlite-misused.py
+++ b/tests/functional-tests/10-sqlite-misused.py
@@ -22,7 +22,7 @@ Test the query while importing at the same time. This was raising
 some SQLITE_MISUSED errors before.
 """
 import os, dbus
-import gobject
+from gi.repository import GObject
 from dbus.mainloop.glib import DBusGMainLoop
 
 from common.utils import configuration as cfg
@@ -35,7 +35,7 @@ class TestSqliteMisused (CommonTrackerStoreTest):
     Send queries while importing files (in .ttl directory)
     """
     def setUp (self):
-        self.main_loop = gobject.MainLoop ()
+        self.main_loop = GObject.MainLoop ()
         self.files_counter = 0
         
     def test_queries_while_import (self):
@@ -49,9 +49,9 @@ class TestSqliteMisused (CommonTrackerStoreTest):
                                      reply_handler=self.loaded_success_cb,
                                      error_handler=self.loaded_failed_cb)
         
-        gobject.timeout_add_seconds (2, self.run_a_query)
+        GObject.timeout_add_seconds (2, self.run_a_query)
         # Safeguard of 60 seconds. The last reply should quit the loop
-        gobject.timeout_add_seconds (60, self.timeout_cb)
+        GObject.timeout_add_seconds (60, self.timeout_cb)
         self.main_loop.run ()
 
     def run_a_query (self):
diff --git a/tests/functional-tests/11-sqlite-batch-misused.py 
b/tests/functional-tests/11-sqlite-batch-misused.py
index be24044..230fe99 100755
--- a/tests/functional-tests/11-sqlite-batch-misused.py
+++ b/tests/functional-tests/11-sqlite-batch-misused.py
@@ -22,7 +22,7 @@ Test the query while running BatchSparqlUpdate at the same time. This was raisin
 some SQLITE_MISUSED errors before.
 """
 import os, dbus
-import gobject
+from gi.repository import GObject
 from dbus.mainloop.glib import DBusGMainLoop
 
 from common.utils import configuration as cfg
@@ -40,7 +40,7 @@ class TestSqliteBatchMisused (CommonTrackerStoreTest):
     to configure properly the environment
     """
     def setUp (self):
-        self.main_loop = gobject.MainLoop ()
+        self.main_loop = GObject.MainLoop ()
         self.batch_counter = 0
         
     def test_queries_while_batch_insert (self):
@@ -72,9 +72,9 @@ class TestSqliteBatchMisused (CommonTrackerStoreTest):
                         self.batch_counter += 1
                         
         
-        gobject.timeout_add_seconds (2, self.run_a_query)
+        GObject.timeout_add_seconds (2, self.run_a_query)
         # Safeguard of 60 seconds. The last reply should quit the loop
-        gobject.timeout_add_seconds (60, self.timeout_cb)
+        GObject.timeout_add_seconds (60, self.timeout_cb)
         self.main_loop.run ()
 
     def run_a_query (self):
diff --git a/tests/functional-tests/13-threaded-store.py b/tests/functional-tests/13-threaded-store.py
index 7caddeb..b0d7cc8 100755
--- a/tests/functional-tests/13-threaded-store.py
+++ b/tests/functional-tests/13-threaded-store.py
@@ -22,7 +22,7 @@ Test that the threads in the daemon are working:
  A very long query shouldn't block smaller queries.
 """
 import os, dbus
-import gobject
+from gi.repository import GObject
 import glib
 import time
 from dbus.mainloop.glib import DBusGMainLoop
@@ -46,7 +46,7 @@ class TestThreadedStore (CommonTrackerStoreTest):
     Reported in bug NB#183499
     """
     def setUp (self):
-        self.main_loop = gobject.MainLoop ()
+        self.main_loop = GObject.MainLoop ()
         self.simple_queries_counter = AMOUNT_SIMPLE_QUERIES
         self.simple_queries_answers = 0
 
diff --git a/tests/functional-tests/14-signals.py b/tests/functional-tests/14-signals.py
index c999f05..c5fce41 100755
--- a/tests/functional-tests/14-signals.py
+++ b/tests/functional-tests/14-signals.py
@@ -27,7 +27,7 @@ import unittest2 as ut
 from common.utils.storetest import CommonTrackerStoreTest as CommonTrackerStoreTest
 from common.utils import configuration as cfg
 
-import gobject
+from gi.repository import GObject
 import glib
 import dbus
 from dbus.mainloop.glib import DBusGMainLoop
@@ -49,7 +49,7 @@ class TrackerStoreSignalsTests (CommonTrackerStoreTest):
     """
     def setUp (self):
         self.clean_up_list = []
-        self.loop = gobject.MainLoop()
+        self.loop = GObject.MainLoop()
         dbus_loop = DBusGMainLoop(set_as_default=True)
         self.bus = dbus.SessionBus (dbus_loop)
         self.timeout_id = 0
diff --git a/tests/functional-tests/common/utils/helpers.py b/tests/functional-tests/common/utils/helpers.py
index 70ba1d4..3a79a50 100644
--- a/tests/functional-tests/common/utils/helpers.py
+++ b/tests/functional-tests/common/utils/helpers.py
@@ -19,7 +19,7 @@
 #
 import dbus
 import glib
-import gobject
+from gi.repository import GObject
 import commands
 import os
 import signal
@@ -62,7 +62,7 @@ class Helper:
         if self.bus is not None:
             return
 
-        self.loop = gobject.MainLoop ()
+        self.loop = GObject.MainLoop ()
 
         dbus_loop = DBusGMainLoop (set_as_default=True)
         self.bus = dbus.SessionBus (dbus_loop)
diff --git a/tests/functional-tests/common/utils/system.py b/tests/functional-tests/common/utils/system.py
index c1d5707..a3ca69a 100644
--- a/tests/functional-tests/common/utils/system.py
+++ b/tests/functional-tests/common/utils/system.py
@@ -4,7 +4,7 @@ import subprocess
 import shutil
 import configuration as cfg
 
-import gobject
+from gi.repository import GObject
 import glib
 import dbus
 from dbus.mainloop.glib import DBusGMainLoop
@@ -232,14 +232,14 @@ if __name__ == "__main__":
     def destroy_the_world (a):
         a.tracker_store_testing_stop ()
         print "   stopped"
-        gtk.main_quit()
+        Gtk.main_quit()
 
     print "-- Starting store --"
     a = TrackerSystemAbstraction ()
     a.tracker_store_testing_start ()
     print "   started, waiting 5 sec. to stop it"
     glib.timeout_add_seconds (5, destroy_the_world, a)
-    gtk.main ()
+    Gtk.main ()
 
     print "-- Starting miner-fs --"
     b = TrackerMinerFsLifeCycle ()
diff --git a/tests/functional-tests/fts-tc.py b/tests/functional-tests/fts-tc.py
index 025dcc1..1c5686d 100644
--- a/tests/functional-tests/fts-tc.py
+++ b/tests/functional-tests/fts-tc.py
@@ -27,7 +27,7 @@ import random
 import commands
 import configuration
 from dbus.mainloop.glib import DBusGMainLoop
-import gobject
+from gi.repository import GObject
 import shutil
 from subprocess import Popen,PIPE
 
@@ -115,7 +115,7 @@ class TestUpdate (unittest.TestCase):
         self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
 
 
-        self.loop = gobject.MainLoop()
+        self.loop = GObject.MainLoop()
         self.dbus_loop = DBusGMainLoop(set_as_default=True)
         self.bus = dbus.SessionBus (self.dbus_loop)
 
diff --git a/tests/functional-tests/mass-storage-mode.py b/tests/functional-tests/mass-storage-mode.py
index fe19a8a..0844b21 100644
--- a/tests/functional-tests/mass-storage-mode.py
+++ b/tests/functional-tests/mass-storage-mode.py
@@ -25,7 +25,7 @@ import random
 import commands
 import configuration
 from dbus.mainloop.glib import DBusGMainLoop
-import gobject
+from gi.repository import GObject
 import shutil
 
 TRACKER = 'org.freedesktop.Tracker1'
@@ -95,7 +95,7 @@ class TestUpdate (unittest.TestCase):
         self.miner=dbus.Interface (miner_obj,dbus_interface=MINER_IFACE)
 
 
-        self.loop = gobject.MainLoop()
+        self.loop = GObject.MainLoop()
         self.dbus_loop = DBusGMainLoop(set_as_default=True)
         self.bus = dbus.SessionBus (self.dbus_loop)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]