[commit] r1527 - in trunk/Tests/GPyUnit: GME_297 GME_310
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Mon Sep 12 11:28:12 CDT 2011
Author: ksmyth
Date: Mon Sep 12 11:28:12 2011
New Revision: 1527
Log:
style
Modified:
trunk/Tests/GPyUnit/GME_297/__init__.py
trunk/Tests/GPyUnit/GME_310/__init__.py
Modified: trunk/Tests/GPyUnit/GME_297/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/GME_297/__init__.py Mon Sep 12 11:25:50 2011 (r1526)
+++ trunk/Tests/GPyUnit/GME_297/__init__.py Mon Sep 12 11:28:12 2011 (r1527)
@@ -6,12 +6,13 @@
import win32com.client
class TestRefportConnectionInvariantUnderMoves(unittest.TestCase):
- def __init__(self, input_file, fco_to_move, destination_model, name=None, use_disp=None):
- unittest.TestCase.__init__(self, 'test')
+ def __init__(self, input_file, fco_to_move, destination_model, name=None, use_disp=None, **kwds):
+ super(TestRefportConnectionInvariantUnderMoves, self).__init__('test', **kwds)
self.input_file = input_file
self.fco_to_move = fco_to_move
self.destination_model = destination_model
name = name if name else os.path.splitext(self.input_file)[0]
+ self._testMethodDoc = name
self.output_file = name + "-output.mga"
self.correct_file = name + "-correct.mga"
if use_disp:
@@ -19,9 +20,9 @@
def test(self):
- '''
+ """
Regression test: given self.input_file, move self.fco_to_move to self.destination_model. Then check self.output_file against self.correct_file
- '''
+ """
def _adjacent_file(file):
import os.path
return os.path.join(os.path.dirname(__file__), file)
Modified: trunk/Tests/GPyUnit/GME_310/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/GME_310/__init__.py Mon Sep 12 11:25:50 2011 (r1526)
+++ trunk/Tests/GPyUnit/GME_310/__init__.py Mon Sep 12 11:28:12 2011 (r1527)
@@ -6,48 +6,43 @@
import win32com.client
class TestFolderCopy(unittest.TestCase):
- def __init__(self, input_file, folder_to_copy, destination_folder, name=None):
- unittest.TestCase.__init__(self, 'test')
+ def __init__(self, input_file, folder_to_copy, destination_folder, name=None, **kwds):
+ super(TestFolderCopy, self).__init__('test', **kwds)
self.input_file = input_file
self.folder_to_copy = folder_to_copy
self.destination_folder = destination_folder
name = name if name else os.path.splitext(self.input_file)[0]
+ self._testMethodDoc = name
self.output_file = name + "-output.mga"
self.correct_file = name + "-correct.mga"
def test(self):
- '''
+ """
Regression test: given self.input_file, move self.folder_to_copy to self.destination_folder. Then check self.output_file against self.correct_file
- '''
+ """
def _adjacent_file(file):
import os.path
return os.path.join(os.path.dirname(__file__), file)
import util
util.register_xmp(_adjacent_file('GME310ModelRefportTest.xmp'))
- # TODO with util.disable_early_binding()
- # This script depends on late binding. win32com.client.dynamic.Dispatch forces late binding when creating an object,
- # but early-bound objects may be returned from function calls. Disable late binding completely.
- import win32com.client.gencache
- _savedGetClassForCLSID = win32com.client.gencache.GetClassForCLSID
- win32com.client.gencache.GetClassForCLSID = lambda x: None
-
- self.project = win32com.client.DispatchEx("Mga.MgaProject")
- self.project.Open("MGA=" + _adjacent_file(self.input_file))
- self.territory = self.project.BeginTransactionInNewTerr()
-
- modelb = self.project.ObjectByPath(self.folder_to_copy)
- modelb.Name
- tomove = win32com.client.DispatchEx("Mga.MgaFolders")
- tomove.Append(modelb)
- #self.project.ObjectByPath(self.destination_folder).CopyFolders(tomove, None)
- self.project.RootFolder.CopyFolders(tomove, None)
-
- self.project.CommitTransaction()
- self.project.Save("MGA=" + _adjacent_file(self.output_file))
- self.territory.Destroy()
- self.project.Close()
- win32com.client.gencache.GetClassForCLSID = _savedGetClassForCLSID
+ with util.disable_early_binding():
+ self.project = win32com.client.DispatchEx("Mga.MgaProject")
+ self.project.Open("MGA=" + _adjacent_file(self.input_file))
+ self.territory = self.project.BeginTransactionInNewTerr()
+
+ modelb = self.project.ObjectByPath(self.folder_to_copy)
+ modelb.Name
+ tomove = win32com.client.DispatchEx("Mga.MgaFolders")
+ tomove.Append(modelb)
+ #self.project.ObjectByPath(self.destination_folder).CopyFolders(tomove, None)
+ self.project.RootFolder.CopyFolders(tomove, None)
+
+ self.project.CommitTransaction()
+ self.project.Save("MGA=" + _adjacent_file(self.output_file))
+ self.territory.Destroy()
+ self.project.Close()
+
import util.mgadiff as mgadiff
if not mgadiff.compare(_adjacent_file(self.correct_file), _adjacent_file(self.output_file)):
self.fail("Reference file '%s' does not match output '%s'" % (self.correct_file, self.output_file))
More information about the gme-commit
mailing list