gnome-python-desktop r508 - in trunk: . tests



Author: gjc
Date: Thu Dec 25 18:22:31 2008
New Revision: 508
URL: http://svn.gnome.org/viewvc/gnome-python-desktop?rev=508&view=rev

Log:
Run tests from the WAF build system too

Modified:
   trunk/ChangeLog
   trunk/tests/common.py
   trunk/tests/runtests.py
   trunk/wscript

Modified: trunk/tests/common.py
==============================================================================
--- trunk/tests/common.py	(original)
+++ trunk/tests/common.py	Thu Dec 25 18:22:31 2008
@@ -16,27 +16,30 @@
     "rsvg",
     "gnomekeyring",
     "gnomedesktop",
+    ("evolution.ebook", "evolution"),
+    ("evolution.ecal", "evolution"),
     ]
 
-import ltihooks
-ltihooks.install()
+def run_import_tests(builddir):
+    import ltihooks
+    ltihooks.install()
 
-for item in modules:
-    if isinstance(item, tuple):
-        module, dirname = item
-    else:
-        module = item
-        dirname = item
-    sys.path.insert(0, os.path.join("..", dirname))
-    print "Trying to import module %s... " % (module,),
-    try:
-        __import__(module) # try to import the module to catch undefined symbols
-    except ImportError, ex:
-        if ex.args[0].startswith("No module named"):
-            print "not found"
+    for item in modules:
+        if isinstance(item, tuple):
+            module, dirname = item
         else:
-            raise
-    else:
-        print "ok."
+            module = item
+            dirname = item
+        sys.path.insert(0, os.path.join(builddir, dirname))
+        print "Trying to import module %s... " % (module,),
+        try:
+            __import__(module) # try to import the module to catch undefined symbols
+        except ImportError, ex:
+            if ex.args[0].startswith("No module named"):
+                print "not found"
+            else:
+                raise
+        else:
+            print "ok."
 
-ltihooks.uninstall()
+    ltihooks.uninstall()

Modified: trunk/tests/runtests.py
==============================================================================
--- trunk/tests/runtests.py	(original)
+++ trunk/tests/runtests.py	Thu Dec 25 18:22:31 2008
@@ -5,6 +5,13 @@
 import unittest
 import common
 
+if sys.argv > 1:
+    builddir = sys.argv[1]
+else:
+    builddir = '..'
+
+common.run_import_tests(builddir)
+
 SKIP_FILES = ['common', 'runtests']
 
 dir = os.path.split(os.path.abspath(__file__))[0]

Modified: trunk/wscript
==============================================================================
--- trunk/wscript	(original)
+++ trunk/wscript	Thu Dec 25 18:22:31 2008
@@ -160,3 +160,29 @@
     bld.add_subdirs('docs/gnomeprintui')
     bld.add_subdirs('docs/gtksourceview')
 
+
+def shutdown():
+    env = Params.g_build.env_of_name('default')
+
+    if Params.g_commands['check']:
+        _run_tests(env)
+
+
+def _run_tests(env):
+    import pproc as subprocess
+    import shutil
+    builddir = os.path.join(blddir, env.variant())
+    # copy the __init__.py files
+    for subdir in ["evolution", "gnomedesktop", "gnomeprint", "totem"]:
+        src = os.path.join(subdir, "__init__.py")
+        dst = os.path.join(builddir, subdir)
+        shutil.copy(src, dst)
+    os_env = dict(os.environ)
+    if 'PYTHONPATH' in os_env:
+        os_env['PYTHONPATH'] = os.pathsep.join([builddir, os_env['PYTHONPATH']])
+    else:
+        os_env['PYTHONPATH'] = builddir
+    cmd = [env['PYTHON'], os.path.join('tests', 'runtests.py'), builddir]
+    retval = subprocess.Popen(cmd, env=os_env).wait()
+    if retval:
+        sys.exit(retval)



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