[gnome-code-assistance] [tests] Test dispose and exit after dispose



commit d772de18b7bbf1604cb105cd5ecabf1ac329a151
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Nov 15 01:05:56 2013 +0100

    [tests] Test dispose and exit after dispose

 tests/service |   31 ++++++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/tests/service b/tests/service
index 2595593..16de416 100755
--- a/tests/service
+++ b/tests/service
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-import sys, dbus, json, subprocess, os, glob, traceback, shutil, re
+import sys, dbus, json, subprocess, os, glob, traceback, shutil, re, time
 import lxml.objectify
 
 sys.path.insert(0, os.path.dirname(__file__))
@@ -331,10 +331,32 @@ class ServiceTest:
         with self.test_diagnostics(path) as t:
             t(orig, ret)
 
+    @test('exited')
+    def test_exited(self):
+        try:
+            self.bus.get_name_owner(self.name)
+        except:
+            return
+
+        raise ValueError('Service did not exit')
+
+    @test('dispose')
+    def test_dispose(self, path):
+        obj = self.get_object('/')
+        iface = dbus.Interface(obj, 'org.gnome.CodeAssist.v1.Service')
+        iface.Dispose(path)
+        time.sleep(0.1)
+
     def test_parse(self, d):
         path, parsed = self.run_parse(d['parse'])
         self.verify_parse_diagnostics(path, parsed, d['diagnostics'])
 
+        with self.test_dispose(self.file_path(d['parse']['path'])) as t:
+            t()
+
+        with self.test_exited() as t:
+            t()
+
     def test_parse_all(self, d):
         docs = self.run_parse_all(d['parse_all'])
 
@@ -355,6 +377,13 @@ class ServiceTest:
 
             self.verify_parse_diagnostics(remote, obj, diags[k])
 
+        for k in docmap:
+            with self.test_dispose(k) as t:
+                t()
+
+        with self.test_exited() as t:
+            t()
+
     def run_diagnostic(self, d):
         if 'parse' in d:
             self.test_parse(d)


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