2 new revisions:

Revision: de9eb28d1c45
Author:   Janne Härkönen <j...@reaktor.fi>
Date:     Mon Apr 18 21:23:22 2011
Log:      runner: Doc addition
http://code.google.com/p/robotframework/source/detail?r=de9eb28d1c45

Revision: 3b8be6acfb01
Author:   Janne Härkönen <j...@reaktor.fi>
Date:     Mon Apr 18 21:30:37 2011
Log:      nostatusrc: do calculation in BaseSuite...
http://code.google.com/p/robotframework/source/detail?r=3b8be6acfb01

==============================================================================
Revision: de9eb28d1c45
Author:   Janne Härkönen <j...@reaktor.fi>
Date:     Mon Apr 18 21:23:22 2011
Log:      runner: Doc addition
http://code.google.com/p/robotframework/source/detail?r=de9eb28d1c45

Modified:
 /src/robot/runner.py

=======================================
--- /src/robot/runner.py        Mon Apr 18 07:59:36 2011
+++ /src/robot/runner.py        Mon Apr 18 21:23:22 2011
@@ -223,7 +223,7 @@
files. By default skipped files only cause an info
                           level log message.
--nostatusrc Sets the return code to zero regardless of failures
-                          in test cases.
+                          in test cases. Error codes are returned normally.
  -W --monitorwidth chars  Width of the monitor output. Default is 78.
  -C --monitorcolors auto|on|off  Use colors on console output or not.
auto: use colors when output not redirected (default)

==============================================================================
Revision: 3b8be6acfb01
Author:   Janne Härkönen <j...@reaktor.fi>
Date:     Mon Apr 18 21:30:37 2011
Log:      nostatusrc: do calculation in BaseSuite

I did not realize earlier that __init___::run() and
__init___::rebot() are part of the public API and their
return values should not be changed.

Now the suite has property `return_code` which takes into
account the value of setting `NoStatusRC`
http://code.google.com/p/robotframework/source/detail?r=3b8be6acfb01

Modified:
 /src/robot/__init__.py
 /src/robot/common/model.py

=======================================
--- /src/robot/__init__.py      Mon Apr 18 07:59:36 2011
+++ /src/robot/__init__.py      Mon Apr 18 21:30:37 2011
@@ -82,7 +82,7 @@

 def _execute(method, datasources, options):
     try:
-        critical_failures = method(*datasources, **options)
+        suite = method(*datasources, **options)
     except DataError, err:
         _exit(DATA_ERROR, unicode(err))
     except (KeyboardInterrupt, SystemExit):
@@ -91,7 +91,7 @@
         error, details = utils.get_error_details()
         _exit(FRAMEWORK_ERROR, 'Unexpected error: %s' % error, details)
     else:
-        _exit(critical_failures)
+        _exit(suite.return_code)


 def run(*datasources, **options):
@@ -129,7 +129,7 @@
             testoutput = RebotTestOutput(datasources, settings)
         testoutput.serialize(settings)
     LOGGER.close()
-    return _return_code(suite, settings)
+    return suite


 def run_rebot(*datasources, **options):
@@ -153,15 +153,7 @@
     testoutput = RebotTestOutput(datasources, settings)
     testoutput.serialize(settings, generator='Rebot')
     LOGGER.close()
-    return _return_code(testoutput.suite, settings)
-
-
-def _return_code(suite, settings):
-    return _failed_critical_test_count(suite) if \
-                not settings['NoStatusRC'] else 0
-
-def _failed_critical_test_count(suite):
-    return min(suite.critical_stats.failed, 250)
+    return testoutput.suite


 def _exit(rc, message=None, details=None):
=======================================
--- /src/robot/common/model.py  Sun Feb  6 01:24:10 2011
+++ /src/robot/common/model.py  Mon Apr 18 21:30:37 2011
@@ -219,7 +219,7 @@
                         if suite._filter_by_names(suites, tests) ]
         if not suites:
             self.tests = [ test for test in self.tests if tests == [] or
-                           any(utils.matches_any(name, tests, ignore=['_'])
+                           any(utils.matches_any(name, tests, ignore=['_'])
for name in [test.name, test.get_long_name()])]
         else:
             self.tests = []
@@ -305,6 +305,7 @@
         self.set_doc(settings['Doc'])
         self.set_metadata(settings['Metadata'])
self.set_critical_tags(settings['Critical'], settings['NonCritical'])
+        self._no_status_rc = settings['NoStatusRC']
         try:
             for runmode in settings['RunMode']:
                 self.set_runmode(runmode)
@@ -329,6 +330,11 @@
             test.serialize(serializer)
         serializer.end_suite(self)

+    @property
+    def return_code(self):
+        return min(self.critical_stats.failed, 250) \
+                if not self._no_status_rc else 0
+

 class BaseTestCase(_TestAndSuiteHelper):

Reply via email to