Revision: 6b0bda2bccb4
Branch: default
Author: Pekka Klärck
Date: Tue May 28 09:55:19 2013
Log: new run: inform context that we are in suite teardown.
Old method of checking suite.status != 'RUNNING' didn't work anymore because
new result suite calculates status automatically.
This fixes about 30 tests.
http://code.google.com/p/robotframework/source/detail?r=6b0bda2bccb4
Modified:
/src/robot/new_running/runner.py
/src/robot/running/context.py
=======================================
--- /src/robot/new_running/runner.py Tue May 28 07:13:24 2013
+++ /src/robot/new_running/runner.py Tue May 28 09:55:19 2013
@@ -68,8 +68,8 @@
self.result = Result(root_suite=result)
else:
self._suite.suites.append(result)
+ self._suite = result
self._suite_status = ExecutionStatus(self._suite_status)
- self._suite = result
self._output.start_suite(self._suite)
self._run_setup(suite.keywords.setup, self._suite_status)
self._executed_tests = utils.NormalizedDict(ignore='_')
@@ -78,9 +78,10 @@
return self._variables.replace_string(value, ignore_errors=True)
def end_suite(self, suite):
- failure = self._run_teardown(suite.keywords.teardown,
self._suite_status)
- if failure:
- self._suite.suite_teardown_failed(unicode(failure))
+ with self._context.in_suite_teardown:
+ failure = self._run_teardown(suite.keywords.teardown,
self._suite_status)
+ if failure:
+ self._suite.suite_teardown_failed(unicode(failure))
self._suite.endtime = utils.get_timestamp()
self._suite.message = self._suite_status.message
self._context.end_suite(self._suite)
=======================================
--- /src/robot/running/context.py Tue Jan 29 12:54:39 2013
+++ /src/robot/running/context.py Tue May 28 09:55:19 2013
@@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+from __future__ import with_statement
+
+from contextlib import contextmanager
+
from robot.errors import DataError
from robot.variables import GLOBAL_VARIABLES
@@ -55,23 +59,35 @@
self.namespace = namespace
self.output = output
self.dry_run = dry_run
- self._in_teardown = 0
+ self._in_suite_teardown = False
+ self._in_keyword_teardown = 0
self._started_keywords = 0
+ # TODO: Clean-up needed here ....
+
+ @property
+ @contextmanager
+ def in_suite_teardown(self):
+ self._in_suite_teardown = True
+ try:
+ yield
+ finally:
+ self._in_suite_teardown = False
+
@property
def teardown(self):
- if self._in_teardown:
+ if self._in_suite_teardown or self._in_keyword_teardown:
return True
- test_or_suite = self.namespace.test or self.namespace.suite
- return test_or_suite.status != 'RUNNING'
+ test = self.namespace.test
+ return test and test.status != 'RUNNING'
def start_keyword_teardown(self, error):
self.namespace.variables['${KEYWORD_STATUS}'] = 'FAIL' if error
else 'PASS'
self.namespace.variables['${KEYWORD_MESSAGE}'] = unicode(error
or '')
- self._in_teardown += 1
+ self._in_keyword_teardown += 1
def end_keyword_teardown(self):
- self._in_teardown -= 1
+ self._in_keyword_teardown -= 1
def get_current_vars(self):
return self.namespace.variables
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.