[commit] r2315 - in trunk/Tests/GPyUnit: . util
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Aug 29 11:20:04 CDT 2013
Author: ksmyth
Date: Thu Aug 29 11:20:04 2013
New Revision: 2315
Log:
test: try to leave MetaGME registration the way we found it
Modified:
trunk/Tests/GPyUnit/test_MetaInterpreter.py
trunk/Tests/GPyUnit/util/__init__.py
Modified: trunk/Tests/GPyUnit/test_MetaInterpreter.py
==============================================================================
--- trunk/Tests/GPyUnit/test_MetaInterpreter.py Thu Aug 29 11:19:39 2013 (r2314)
+++ trunk/Tests/GPyUnit/test_MetaInterpreter.py Thu Aug 29 11:20:04 2013 (r2315)
@@ -31,15 +31,24 @@
self.assertEqual(atomattrs, list(atomattributes.split()))
finally:
metaproj.Close()
-
-
- def tearDown(self):
+
+ def _rm_old_files(self):
for file in ("MetaGME.xmp", "MetaGME.mta", "MetaGME.xmp.log"):
if os.path.isfile(os.path.join(self.outdir(), file)):
os.unlink(os.path.join(self.outdir(), file))
+
+ def tearDown(self):
+ self._rm_old_files()
registrar = DispatchEx("Mga.MgaRegistrar")
- registrar.RegisterParadigmFromData("XML=" + os.path.abspath(os.path.join(os.environ['GME_ROOT'], "Paradigms\\MetaGME\\MetaGME.xmp")), "MetaGME", 1)
- setUp = tearDown
+ if self.old_reg_data is None:
+ registrar.UnregisterParadigm("MetaGME", 1)
+ else:
+ registrar.RegisterParadigm(*self.old_reg_data)
+
+
+ def setUp(self):
+ self._rm_old_files()
+ self.old_reg_data = GPyUnit.util.get_MetaGME_user_reg_data()
@property
def connstr(self):
@@ -73,17 +82,27 @@
self.assertTrue(os.path.isfile(os.path.join(self.outdir(), "ISIS.GME.Dsml.MetaGME.dll")))
- def tearDown(self):
- for file in ("MetaGME.xmp", "MetaGME.mta", "MetaGME.xmp.log"):
- if os.path.isfile(os.path.join(self.outdir(), file)):
- os.unlink(os.path.join(self.outdir(), file))
- registrar = DispatchEx("Mga.MgaRegistrar")
- registrar.RegisterParadigmFromData("XML=" + os.path.abspath(os.path.join(os.environ['GME_ROOT'], "Paradigms\\MetaGME\\MetaGME.xmp")), "MetaGME", 1)
+ def _rm_old_files(self):
+ for filename in ("MetaGME.xmp", "MetaGME.mta", "MetaGME.xmp.log"):
+ if os.path.isfile(os.path.join(self.outdir(), filename)):
+ os.unlink(os.path.join(self.outdir(), filename))
for filename in ("AssemblySignature.snk", "ISIS.GME.Dsml.MetaGME.Classes.cs", "ISIS.GME.Dsml.MetaGME.dll", "ISIS.GME.Dsml.MetaGME.Interfaces.cs", "ISIS.GME.Dsml.MetaGME.xml", "ISIS.GME.Dsml.pdb"):
path = os.path.join(self.outdir(), filename)
if os.path.isfile(path):
os.unlink(path)
- setUp = tearDown
+
+ def tearDown(self):
+ registrar = DispatchEx("Mga.MgaRegistrar")
+ if self.old_reg_data is None:
+ registrar.UnregisterParadigm("MetaGME", 1)
+ else:
+ registrar.RegisterParadigm(*self.old_reg_data)
+ self._rm_old_files()
+
+
+ def setUp(self):
+ self.old_reg_data = GPyUnit.util.get_MetaGME_user_reg_data()
+ self._rm_old_files()
@property
def connstr(self):
Modified: trunk/Tests/GPyUnit/util/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/util/__init__.py Thu Aug 29 11:19:39 2013 (r2314)
+++ trunk/Tests/GPyUnit/util/__init__.py Thu Aug 29 11:20:04 2013 (r2315)
@@ -171,3 +171,20 @@
for name, opts in (('MUSVN', ''), ('MUSVNHashed', ' hash=\"true\" hval=\"256\"')):
module[test.__name__ + name] = type(test.__name__ + name, (MUSVNTestMixin, test), {'opts': opts_f(opts)})
+
+
+def get_MetaGME_user_reg_data():
+ registrar = DispatchEx("Mga.MgaRegistrar")
+ try:
+ meta_gme_guid = registrar.ParadigmGUIDString(1, "MetaGME")
+ except:
+ # not registered in user
+ return None
+ else:
+ # get MetaGME ConnStr (can't get it out of registrar with Jython)
+ project = DispatchEx("Mga.MgaProject")
+ project.Create("MGA=" + "get_MetaGME_user_reg_data.mga", "MetaGME")
+ meta_gme_connstr = project.ParadigmConnStr
+ project.Close(True)
+ return ("MetaGME", meta_gme_connstr, None, meta_gme_guid, 1)
+
More information about the gme-commit
mailing list