[commit] r1743 - in trunk/Tests/GPyUnit: . util

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Dec 9 09:25:57 CST 2011


Author: ksmyth
Date: Fri Dec  9 09:25:52 2011
New Revision: 1743

Log:
Start of x64 testing

Modified:
   trunk/Tests/GPyUnit/test_registry.py
   trunk/Tests/GPyUnit/util/__init__.py

Modified: trunk/Tests/GPyUnit/test_registry.py
==============================================================================
--- trunk/Tests/GPyUnit/test_registry.py	Fri Dec  9 09:25:38 2011	(r1742)
+++ trunk/Tests/GPyUnit/test_registry.py	Fri Dec  9 09:25:52 2011	(r1743)
@@ -2,6 +2,7 @@
 import sys
 import os.path
 import unittest
+import GPyUnit.util
 import win32com.client
 
 def _adjacent_file(file):
@@ -12,6 +13,7 @@
     def __init__(self, name, **kwds):
         super(TestRegistry, self).__init__(name, **kwds)
         self.output_file = "TestRegistry-output.mga"
+        self.project = None
         
     def tearDown(self):
         if not self.project is None:
@@ -25,7 +27,7 @@
         from GPyUnit import util
         util.register_xmp('MetaGME')
         with util.disable_early_binding():
-            self.project = win32com.client.DispatchEx("Mga.MgaProject")
+            self.project = GPyUnit.util.DispatchEx("Mga.MgaProject")
             self.project.Create(self.connstr, "MetaGME")
             self.project.BeginTransactionInNewTerr()
             
@@ -119,7 +121,7 @@
         from GPyUnit import util
         util.register_xmp('MetaGME')
         with util.disable_early_binding():
-            self.project = win32com.client.DispatchEx("Mga.MgaProject")
+            self.project = GPyUnit.util.DispatchEx("Mga.MgaProject")
             self.project.Create(self.connstr, "MetaGME")
             self.project.BeginTransactionInNewTerr()
             
@@ -148,7 +150,7 @@
         from GPyUnit import util
         util.register_xmp('MetaGME')
         with util.disable_early_binding():
-            self.project = win32com.client.DispatchEx("Mga.MgaProject")
+            self.project = GPyUnit.util.DispatchEx("Mga.MgaProject")
             self.project.Create(self.connstr, "MetaGME")
             self.project.BeginTransactionInNewTerr()
             
@@ -167,7 +169,7 @@
         from GPyUnit import util
         util.register_xmp('MetaGME')
         with util.disable_early_binding():
-            self.project = win32com.client.DispatchEx("Mga.MgaProject")
+            self.project = GPyUnit.util.DispatchEx("Mga.MgaProject")
             self.project.Open("MGA=" + r"C:\Users\ksmyth\Documents\META\meta\CyPhyML\CyPhyML.mga")
             self.project.BeginTransactionInNewTerr()
             self.project.RootFolder.ChildFolders

Modified: trunk/Tests/GPyUnit/util/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/util/__init__.py	Fri Dec  9 09:25:38 2011	(r1742)
+++ trunk/Tests/GPyUnit/util/__init__.py	Fri Dec  9 09:25:52 2011	(r1743)
@@ -2,18 +2,23 @@
 import os
 import sys
 import unittest
+import win32com.client
 
-_Dispatch_x64 = False
+_opts = type("Options", (object,), {
+'Dispatch_x64': False,
+'Run_SVN': False,
+})
 
-def Dispatch(progid):
+def DispatchEx(progid):
     from pythoncom import CLSCTX_ALL, CLSCTX_LOCAL_SERVER
     CLSCTX_ACTIVATE_32_BIT_SERVER = 0x40000
     CLSCTX_ACTIVATE_64_BIT_SERVER = 0x80000
-    if _Dispatch_x64:
+    if _opts.Dispatch_x64:
         return win32com.client.DispatchEx(progid, clsctx=CLSCTX_LOCAL_SERVER|CLSCTX_ACTIVATE_64_BIT_SERVER)
     else:
+        # FIXME: wrong on x64 python.exe
         return win32com.client.DispatchEx(progid)
-        # return win32com.client.DispatchEx(progid, clsctx=CLSCTX_LOCAL_SERVER|CLSCTX_ACTIVATE_32_BIT_SERVER)
+        # This doesn't work on x86 python.exe on x86 Windows: return win32com.client.DispatchEx(progid, clsctx=CLSCTX_LOCAL_SERVER|CLSCTX_ACTIVATE_32_BIT_SERVER)
 
 class disable_early_binding(object):
 	def __enter__(self):
@@ -23,7 +28,6 @@
 		return self
 	
 	def __exit__(self, exc_type, exc_value, traceback):
-		import win32com.client
 		win32com.client.gencache.GetClassForCLSID = self._savedGetClassForCLSID
 
 def dec_disable_early_binding(f):
@@ -47,12 +51,11 @@
     testdir = os.path.dirname(os.path.abspath(__file__))
     if xme is None:
         xme = os.environ['GME_ROOT'] + r"\Paradigms\MetaGME\MetaGME-model.xme"
-    import win32com.client
-    parser = win32com.client.DispatchEx("Mga.MgaParser")
+    parser = DispatchEx("Mga.MgaParser")
 
     if project is None:
         (paradigm, parversion, parguid, basename, ver) = parser.GetXMLInfo(xme)
-        project = win32com.client.DispatchEx("Mga.MgaProject")
+        project = DispatchEx("Mga.MgaProject")
         project.Create(connstr, paradigm)
     parser.ParseProject(project, xme)
     return project
@@ -119,8 +122,10 @@
         return "MGX=\"" + self.mgxdir + "\" svn=\"" + self.svn_url + "\"" + self.opts()
 
 def MUGenerator(module, test):
+    # XMLBackend on x64 is unsupported
+    if _opts.Dispatch_x64: return
     module[test.__name__ + "MU"] = type(test.__name__ + "MU", (MUTestMixin, test), {})
-    return
+    if not _opts.Run_SVN: return
     def opts_f(opts):
         return lambda self: opts
     for name, opts in (('MUSVN', ''), ('MUSVNHashed', ' hash=\"true\" hval=\"256\"')):


More information about the gme-commit mailing list