[Erp5-report] r30087 - /erp5/trunk/products/ERP5Type/tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 29 07:36:18 CET 2009
Author: nicolas.dumazet
Date: Thu Oct 29 07:36:17 2009
New Revision: 30087
URL: http://svn.erp5.org?rev=30087&view=rev
Log:
enhance todo_erp5 with backportUnittest.skip: tests tagged with this decorator
will now be skipped.
Modified:
erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
erp5/trunk/products/ERP5Type/tests/runUnitTest.py
erp5/trunk/products/ERP5Type/tests/utils.py
Modified: erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py?rev=30087&r1=30086&r2=30087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/ERP5TypeTestCase.py [utf8] Thu Oct 29 07:36:17 2009
@@ -39,6 +39,8 @@
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Base import _aq_reset
from zLOG import LOG, DEBUG
+
+import backportUnittest
# Quiet messages when installing products
install_product_quiet = 1
@@ -218,7 +220,7 @@
# No profiling, return identity decorator
return lambda self, method: method
-class ERP5TypeTestCase(PortalTestCase):
+class ERP5TypeTestCase(backportUnittest.TestCase, PortalTestCase):
"""TestCase for ERP5 based tests.
This TestCase setups an ERP5Site and installs business templates.
Modified: erp5/trunk/products/ERP5Type/tests/runUnitTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runUnitTest.py?rev=30087&r1=30086&r2=30087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runUnitTest.py [utf8] Thu Oct 29 07:36:17 2009
@@ -8,8 +8,9 @@
import shutil
import errno
+import backportUnittest
+
WIN = os.name == 'nt'
-
__doc__ = """%(program)s: unit test runner for the ERP5 Project
@@ -282,7 +283,7 @@
except ImportError:
pass
- TestRunner = unittest.TextTestRunner
+ TestRunner = backportUnittest.TextTestRunner
suite = unittest.TestSuite()
# allow unit tests of our Products or business templates to be reached.
Modified: erp5/trunk/products/ERP5Type/tests/utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/utils.py?rev=30087&r1=30086&r2=30087&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/utils.py [utf8] Thu Oct 29 07:36:17 2009
@@ -35,6 +35,8 @@
import Products.ERP5Type
from Products.MailHost.MailHost import MailHost
from zLOG import LOG
+
+import backportUnittest
class FileUpload(file):
"""Act as an uploaded file.
@@ -240,28 +242,11 @@
self._instance.tic()
return ret
-def todo_erp5(function):
- """
- Use this function as a decorator around a test method to tag it as TODO.
- Tagging as TODO means that:
- - a failure (AssertionError exception) is expected, and will not be
- reported as a failure in test report.
- - a success or any other exception is *not* expected, and will cause the
- test to be reported as failed.
-
- Inspired from Wine's tests (http://www.winehq.org).
- """
- func_code = function.func_code
- function_id = '%s:%s %s' % (func_code.co_filename, func_code.co_firstlineno,
- func_code.co_name)
- def wrapper(*args, **kw):
- try:
- result = function(*args, **kw)
- except AssertionError:
- LOG('TODO', 0, function_id)
- print 'TODO: %s' % (function_id, )
- else:
- raise AssertionError, '%s Succeeded although being tagged as TODO' % (function_id, )
- wrapper.__name__ = function.__name__
- return wrapper
-
+# Use this as a method or class decorator to tag it as TODO.
+# The test will be skipped:
+# - the fixture itself is not run
+# - if a TODO test is in fact successful, no one will ever know
+#
+# Test cases using this decorator must extend backportUnittest.TestCase
+todo_erp5 = backportUnittest.skip("TODO ERP5")
+
More information about the Erp5-report
mailing list