[commit] r1629 - in trunk/Tests/GPyUnit: . GME_297 GME_310 Regr/Mga Regr/Mga/utils
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Oct 13 14:07:44 CDT 2011
Author: ksmyth
Date: Thu Oct 13 14:07:43 2011
New Revision: 1629
Log:
Put tests into GPyUnit namespace (explicit is better than implicit)
Added:
trunk/Tests/GPyUnit/__init__.py (contents, props changed)
trunk/Tests/GPyUnit/__main__.py (contents, props changed)
- copied, changed from r1628, trunk/Tests/GPyUnit/run_tests.py
Deleted:
trunk/Tests/GPyUnit/run_tests.py
Modified:
trunk/Tests/GPyUnit/GME_297/__init__.py
trunk/Tests/GPyUnit/GME_310/__init__.py
trunk/Tests/GPyUnit/Regr/Mga/tc1.py
trunk/Tests/GPyUnit/Regr/Mga/tc4.py
trunk/Tests/GPyUnit/Regr/Mga/tc5.py
trunk/Tests/GPyUnit/Regr/Mga/tc6.py
trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py
trunk/Tests/GPyUnit/test_gmeoleapp.py
Modified: trunk/Tests/GPyUnit/GME_297/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/GME_297/__init__.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/GME_297/__init__.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -26,7 +26,7 @@
def _adjacent_file(file):
import os.path
return os.path.join(os.path.dirname(__file__), file)
- import util
+ from GPyUnit import util
util.register_xmp(_adjacent_file('GME297ModelRefportTest.xmp'))
with util.disable_early_binding():
self.project = win32com.client.DispatchEx("Mga.MgaProject")
@@ -53,7 +53,7 @@
self.territory.Destroy()
self.project.Close()
- import util.mgadiff as mgadiff
+ import GPyUnit.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))
# print "Reference file '%s' matches output '%s'" % (self.correct_file, self.output_file)
Modified: trunk/Tests/GPyUnit/GME_310/__init__.py
==============================================================================
--- trunk/Tests/GPyUnit/GME_310/__init__.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/GME_310/__init__.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -23,7 +23,7 @@
def _adjacent_file(file):
import os.path
return os.path.join(os.path.dirname(__file__), file)
- import util
+ from GPyUnit import util
util.register_xmp(_adjacent_file('GME310ModelRefportTest.xmp'))
with util.disable_early_binding():
@@ -43,7 +43,7 @@
self.territory.Destroy()
self.project.Close()
- import util.mgadiff as mgadiff
+ import GPyUnit.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))
#print "Reference file '%s' matches output '%s'" % (self.correct_file, self.output_file)
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc1.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc1.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc1.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -6,7 +6,7 @@
import utils.Builder
bd = utils.Builder
-from util import dec_disable_early_binding
+from GPyUnit.util import dec_disable_early_binding
class TestCase1( unittest.TestCase ):
"""
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc4.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc4.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc4.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -7,7 +7,7 @@
import utils.Builder
bd = utils.Builder
-from util import dec_disable_early_binding
+from GPyUnit.util import dec_disable_early_binding
class TestCase4( unittest.TestCase ):
#avoid if possible the overriding of __init__, yet if you override use the following form:
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc5.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc5.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc5.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -6,7 +6,7 @@
import utils.Builder
bd = utils.Builder
-from util import dec_disable_early_binding
+from GPyUnit.util import dec_disable_early_binding
class TestCase5( unittest.TestCase ):
"""
Modified: trunk/Tests/GPyUnit/Regr/Mga/tc6.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/tc6.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/Regr/Mga/tc6.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -7,7 +7,7 @@
import utils.Builder
bd = utils.Builder
-from util import dec_disable_early_binding
+from GPyUnit.util import dec_disable_early_binding
class TestCase6( unittest.TestCase ):
def __init__(self, methodName='runTest'):
Modified: trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py
==============================================================================
--- trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/Regr/Mga/utils/Builder.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -116,7 +116,7 @@
def creaP(mganame, parad):
- import util
+ from GPyUnit import util
util.register_xmp(parad)
project = win32com.client.DispatchEx("Mga.MgaProject")
Added: trunk/Tests/GPyUnit/__init__.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/Tests/GPyUnit/__init__.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -0,0 +1,21 @@
+import unittest
+
+import GPyUnit.Regr.Mga.tc1
+
+# it is also possible to run tests like this on Python 2.7:
+# python -m unittest GPyUnit.Regr.Mga.tc7
+_tests = unittest.defaultTestLoader.loadTestsFromNames(
+[ 'GPyUnit.' + test for test in (
+ 'test_registrar',
+ 'test_gmeoleapp',
+ 'test_parser',
+ 'GME_297.suite',
+ 'GME_310.suite',
+ 'GME_371',
+ 'Regr.Mga.tc1',
+ 'Regr.Mga.tc2',
+ 'Regr.Mga.tc3',
+ 'Regr.Mga.tc5',
+ 'Regr.Mga.tc6',
+)])
+
Copied and modified: trunk/Tests/GPyUnit/__main__.py (from r1628, trunk/Tests/GPyUnit/run_tests.py)
==============================================================================
--- trunk/Tests/GPyUnit/run_tests.py Thu Oct 13 11:03:18 2011 (r1628, copy source)
+++ trunk/Tests/GPyUnit/__main__.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -1,42 +1,27 @@
-import unittest
-
-# it is also possible to run tests like this on Python 2.7:
-# python -m unittest Regr.Mga.tc7
-_tests = unittest.defaultTestLoader.loadTestsFromNames((
- 'test_registrar',
- 'test_gmeoleapp',
- 'test_parser',
- 'GME_297.suite',
- 'GME_310.suite',
- 'GME_371',
- 'Regr.Mga.tc1',
- 'Regr.Mga.tc2',
- 'Regr.Mga.tc3',
- 'Regr.Mga.tc5',
- 'Regr.Mga.tc6',
-))
-
-# For debugging
-#import sys
-#sys.stdin.readline()
-
-if __name__=='__main__':
- import optparse
- parser = optparse.OptionParser()
- parser.add_option("-x", "--xml", action="store_true", dest="xml")
- parser.add_option("-v", action="store_true", dest="verbose")
-
- (options, args) = parser.parse_args()
- if options.xml:
- import os.path
- import xmlrunner
- with open("tests.xml", "w") as output:
- output.write("<testsuites>")
- for test in _tests:
- runner = xmlrunner.XMLTestRunner(output)
- runner.run(test)
- output.write("</testsuites>")
- else:
- runner = unittest.TextTestRunner(verbosity=2 if options.verbose else 1)
- runner.run(_tests)
-
+import GPyUnit
+import unittest
+
+# For debugging
+#import sys
+#sys.stdin.readline()
+
+if __name__=='__main__':
+ import optparse
+ parser = optparse.OptionParser()
+ parser.add_option("-x", "--xml", action="store_true", dest="xml")
+ parser.add_option("-v", action="store_true", dest="verbose")
+
+ (options, args) = parser.parse_args()
+ if options.xml:
+ import os.path
+ import xmlrunner
+ with open("tests.xml", "w") as output:
+ output.write("<testsuites>")
+ for test in GPyUnit._tests:
+ runner = xmlrunner.XMLTestRunner(output)
+ runner.run(test)
+ output.write("</testsuites>")
+ else:
+ runner = unittest.TextTestRunner(verbosity=2 if options.verbose else 1)
+ runner.run(GPyUnit._tests)
+
Modified: trunk/Tests/GPyUnit/test_gmeoleapp.py
==============================================================================
--- trunk/Tests/GPyUnit/test_gmeoleapp.py Thu Oct 13 11:03:18 2011 (r1628)
+++ trunk/Tests/GPyUnit/test_gmeoleapp.py Thu Oct 13 14:07:43 2011 (r1629)
@@ -17,7 +17,7 @@
def _adjacent_file(file):
import os.path
- return os.path.join(os.path.dirname(__file__), file)
+ return os.path.join(os.path.dirname(os.path.abspath(__file__)), file)
self.gme = win32com.client.DispatchEx("GME.Application")
self.gme.Version
console = filter(lambda p: p.Name == "Console", self.gme.Panels)[0]
More information about the gme-commit
mailing list