3 new revisions:
Revision: a6bc6c3120d7
Branch: default
Author: Pekka Klärck
Date: Wed May 29 03:04:53 2013
Log: new run: renamed failures module to status and split
ExecutionStatus t...
http://code.google.com/p/robotframework/source/detail?r=a6bc6c3120d7
Revision: 03003cdc594f
Branch: default
Author: Pekka Klärck
Date: Wed May 29 04:40:25 2013
Log: new run: implemented ExitOnFailure. SkipTeardownOnExit not yet
done.
http://code.google.com/p/robotframework/source/detail?r=03003cdc594f
Revision: 18c89aeeb849
Branch: default
Author: Pekka Klärck
Date: Wed May 29 04:40:29 2013
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=18c89aeeb849
==============================================================================
Revision: a6bc6c3120d7
Branch: default
Author: Pekka Klärck
Date: Wed May 29 03:04:53 2013
Log: new run: renamed failures module to status and split
ExecutionStatus to SuiteStatus and TestStatus
http://code.google.com/p/robotframework/source/detail?r=a6bc6c3120d7
Added:
/src/robot/new_running/status.py
Deleted:
/src/robot/new_running/failures.py
Modified:
/src/robot/new_running/runner.py
=======================================
--- /dev/null
+++ /src/robot/new_running/status.py Wed May 29 03:04:53 2013
@@ -0,0 +1,113 @@
+# Copyright 2008-2012 Nokia Siemens Networks Oyj
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+class _ExecutionStatus(object):
+
+ def __init__(self, parent_status=None):
+ self.parent_status = parent_status
+ self.setup_failure = None
+ self.test_failure = None
+ self.teardown_failure = None
+ self.teardown_allowed = False
+
+ def setup_executed(self, failure=None):
+ if failure:
+ self.setup_failure = unicode(failure)
+ self.teardown_allowed = True
+
+ def teardown_executed(self, failure=None):
+ if failure:
+ self.teardown_failure = unicode(failure)
+
+ @property
+ def message(self):
+ if self.parent_status and self.parent_status.failures:
+ message = ParentMessage(self.parent_status)
+ else:
+ message = self._get_message()
+ return unicode(message)
+
+ def _get_message(self):
+ raise NotImplementedError
+
+ @property
+ def failures(self):
+ return bool(self.parent_status and self.parent_status.failures or
+ self.setup_failure or
+ self.test_failure or
+ self.teardown_failure)
+
+ @property
+ def status(self):
+ return 'FAIL' if self.failures else 'PASS'
+
+
+class SuiteStatus(_ExecutionStatus):
+
+ def _get_message(self):
+ return SuiteMessage(self)
+
+
+class TestStatus(_ExecutionStatus):
+
+ def test_failed(self, failure):
+ self.test_failure = unicode(failure)
+
+ def _get_message(self):
+ return TestMessage(self)
+
+
+class TestMessage(object):
+ setup_failed = 'Setup failed:\n%s'
+ teardown_failed = 'Teardown failed:\n%s'
+ also_teardown_failed = '%s\n\nAlso teardown failed:\n%s'
+
+ def __init__(self, status):
+ self.setup = status.setup_failure
+ self.test = status.test_failure or ''
+ self.teardown = status.teardown_failure
+
+ def __unicode__(self):
+ msg = self._get_message_before_teardown()
+ return self._get_message_after_teardown(msg)
+
+ def _get_message_before_teardown(self):
+ if self.setup:
+ return self.setup_failed % self.setup
+ return self.test
+
+ def _get_message_after_teardown(self, msg):
+ if not self.teardown:
+ return msg
+ if not msg:
+ return self.teardown_failed % self.teardown
+ return self.also_teardown_failed % (msg, self.teardown)
+
+
+class SuiteMessage(TestMessage):
+ setup_failed = 'Suite setup failed:\n%s'
+ teardown_failed = 'Suite teardown failed:\n%s'
+ also_teardown_failed = '%s\n\nAlso suite teardown failed:\n%s'
+
+
+class ParentMessage(SuiteMessage):
+ setup_failed = 'Parent suite setup failed:\n%s'
+ teardown_failed = 'Parent suite teardown failed:\n%s'
+ also_teardown_failed = '%s\n\nAlso parent suite teardown failed:\n%s'
+
+ def __init__(self, status):
+ while status.parent_status and status.parent_status.failures:
+ status = status.parent_status
+ SuiteMessage.__init__(self, status)
=======================================
--- /src/robot/new_running/failures.py Tue May 28 06:00:22 2013
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 2008-2012 Nokia Siemens Networks Oyj
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-class ExecutionStatus(object):
-
- def __init__(self, parent_status=None, test=False):
- self.parent_status = parent_status
- self.setup_failure = None
- self.test_failure = None
- self.teardown_failure = None
- self.teardown_allowed = False
- self._test = test
-
- def setup_executed(self, failure=None):
- if failure:
- self.setup_failure = unicode(failure)
- self.teardown_allowed = True
-
- def test_failed(self, failure):
- self.test_failure = unicode(failure)
-
- def teardown_executed(self, failure=None):
- if failure:
- self.teardown_failure = unicode(failure)
-
- @property
- def message(self):
- if self.parent_status and self.parent_status.failures:
- message = ParentMessage(self.parent_status)
- elif self._test:
- message = TestMessage(self)
- else:
- message = SuiteMessage(self)
- return unicode(message)
-
- @property
- def failures(self):
- return bool(self.parent_status and self.parent_status.failures or
- self.setup_failure or
- self.test_failure or
- self.teardown_failure)
-
- @property
- def status(self):
- return 'FAIL' if self.failures else 'PASS'
-
-
-class TestMessage(object):
- setup_failed = 'Setup failed:\n%s'
- teardown_failed = 'Teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso teardown failed:\n%s'
-
- def __init__(self, status):
- self.setup = status.setup_failure
- self.test = status.test_failure or ''
- self.teardown = status.teardown_failure
-
- def __unicode__(self):
- msg = self._get_message_before_teardown()
- return self._get_message_after_teardown(msg)
-
- def _get_message_before_teardown(self):
- if self.setup:
- return self.setup_failed % self.setup
- return self.test
-
- def _get_message_after_teardown(self, msg):
- if not self.teardown:
- return msg
- if not msg:
- return self.teardown_failed % self.teardown
- return self.also_teardown_failed % (msg, self.teardown)
-
-
-class SuiteMessage(TestMessage):
- setup_failed = 'Suite setup failed:\n%s'
- teardown_failed = 'Suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso suite teardown failed:\n%s'
-
-
-class ParentMessage(SuiteMessage):
- setup_failed = 'Parent suite setup failed:\n%s'
- teardown_failed = 'Parent suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso parent suite teardown failed:\n%s'
-
- def __init__(self, status):
- while status.parent_status and status.parent_status.failures:
- status = status.parent_status
- SuiteMessage.__init__(self, status)
=======================================
--- /src/robot/new_running/runner.py Wed May 29 02:35:50 2013
+++ /src/robot/new_running/runner.py Wed May 29 03:04:53 2013
@@ -26,7 +26,7 @@
from robot.errors import ExecutionFailed, DataError
from robot import utils
-from .failures import ExecutionStatus
+from .status import SuiteStatus, TestStatus
class Runner(SuiteVisitor):
@@ -71,7 +71,7 @@
else:
self._suite.suites.append(result)
self._suite = result
- self._suite_status = ExecutionStatus(self._suite_status)
+ self._suite_status = SuiteStatus(self._suite_status)
self._output.start_suite(self._suite)
self._run_setup(suite.keywords.setup, self._suite_status)
self._executed_tests = utils.NormalizedDict(ignore='_')
@@ -107,7 +107,7 @@
status='RUNNING')
keywords = Keywords(test.keywords.normal, test.continue_on_failure)
self._context.start_test(result)
- status = ExecutionStatus(self._suite_status, test=True)
+ status = TestStatus(self._suite_status)
if not test.name:
status.test_failed('Test case name cannot be empty.')
if not keywords:
==============================================================================
Revision: 03003cdc594f
Branch: default
Author: Pekka Klärck
Date: Wed May 29 04:40:25 2013
Log: new run: implemented ExitOnFailure. SkipTeardownOnExit not yet
done.
http://code.google.com/p/robotframework/source/detail?r=03003cdc594f
Modified:
/src/robot/new_running/runner.py
/src/robot/new_running/status.py
=======================================
--- /src/robot/new_running/runner.py Wed May 29 03:04:53 2013
+++ /src/robot/new_running/runner.py Wed May 29 04:40:25 2013
@@ -55,7 +55,8 @@
UserLibrary(suite.user_keywords),
variables)
EXECUTION_CONTEXTS.start_suite(ns, self._output,
self._settings.dry_run)
- ns.handle_imports()
+ if not (self._suite_status and self._suite_status.failures): #
Skips imports if exiting
+ ns.handle_imports()
variables.resolve_delayed()
result = TestSuite(name=suite.name,
doc=self._resolve_setting(suite.doc),
@@ -71,7 +72,8 @@
else:
self._suite.suites.append(result)
self._suite = result
- self._suite_status = SuiteStatus(self._suite_status)
+ self._suite_status = SuiteStatus(self._suite_status,
+ self._settings.exit_on_failure)
self._output.start_suite(self._suite)
self._run_setup(suite.keywords.setup, self._suite_status)
self._executed_tests = utils.NormalizedDict(ignore='_')
@@ -91,7 +93,7 @@
self._suite.message = self._suite_status.message
self._context.end_suite(self._suite)
self._suite = self._suite.parent
- self._suite_status = self._suite_status.parent_status
+ self._suite_status = self._suite_status.parent
def visit_test(self, test):
if test.name in self._executed_tests:
@@ -117,7 +119,7 @@
if not status.failures:
keywords.run(self._context)
except ExecutionFailed, err:
- status.test_failed(err)
+ status.test_failed(err, test.critical)
result.status = status.status
result.message = status.message or result.message
if status.teardown_allowed:
=======================================
--- /src/robot/new_running/status.py Wed May 29 03:04:53 2013
+++ /src/robot/new_running/status.py Wed May 29 04:40:25 2013
@@ -15,12 +15,13 @@
class _ExecutionStatus(object):
- def __init__(self, parent_status=None):
- self.parent_status = parent_status
+ def __init__(self, parent=None):
+ self.parent = parent
self.setup_failure = None
self.test_failure = None
self.teardown_failure = None
self.teardown_allowed = False
+ self.exiting_on_failure = parent.exiting_on_failure if parent else
False
def setup_executed(self, failure=None):
if failure:
@@ -32,82 +33,123 @@
self.teardown_failure = unicode(failure)
@property
- def message(self):
- if self.parent_status and self.parent_status.failures:
- message = ParentMessage(self.parent_status)
- else:
- message = self._get_message()
- return unicode(message)
+ def failures(self):
+ return bool(self._parent_failures() or self._my_failures())
- def _get_message(self):
- raise NotImplementedError
+ def _parent_failures(self):
+ return self.parent and self.parent.failures
- @property
- def failures(self):
- return bool(self.parent_status and self.parent_status.failures or
- self.setup_failure or
+ def _my_failures(self):
+ return bool(self.setup_failure or
+ self.teardown_failure or
self.test_failure or
- self.teardown_failure)
+ self.exiting_on_failure)
@property
def status(self):
return 'FAIL' if self.failures else 'PASS'
+ @property
+ def message(self):
+ if self._my_failures():
+ return self._my_message()
+ if self._parent_failures():
+ return self._parent_message()
+ return ''
+
+ def _my_message(self):
+ raise NotImplementedError
+
+ def _parent_message(self):
+ return ParentMessage(self.parent).message
+
class SuiteStatus(_ExecutionStatus):
- def _get_message(self):
- return SuiteMessage(self)
+ def __init__(self, parent, exit_on_failure_mode=False):
+ _ExecutionStatus.__init__(self, parent)
+ self._exit_on_failure_mode = exit_on_failure_mode
+ def critical_failure(self):
+ if self._exit_on_failure_mode:
+ self.exiting_on_failure = True
+ if self.parent:
+ self.parent.critical_failure()
+
+ def _my_message(self):
+ return SuiteMessage(self).message
+
class TestStatus(_ExecutionStatus):
- def test_failed(self, failure):
+ def __init__(self, suite_status):
+ _ExecutionStatus.__init__(self, suite_status)
+
+ def test_failed(self, failure, critical=True):
self.test_failure = unicode(failure)
+ if critical:
+ self.parent.critical_failure()
- def _get_message(self):
- return TestMessage(self)
+ def _my_message(self):
+ return TestMessage(self).message
-class TestMessage(object):
- setup_failed = 'Setup failed:\n%s'
- teardown_failed = 'Teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso teardown failed:\n%s'
+class _Message(object):
+ setup_message = NotImplemented
+ teardown_message = NotImplemented
+ also_teardown_message = NotImplemented
+ exit_on_failure_message = NotImplemented
def __init__(self, status):
- self.setup = status.setup_failure
- self.test = status.test_failure or ''
- self.teardown = status.teardown_failure
+ self.setup_failure = status.setup_failure
+ self.test_failure = status.test_failure or ''
+ self.teardown_failure = status.teardown_failure
+ self.exiting_on_failure = False
- def __unicode__(self):
+ @property
+ def message(self):
+ if self.exiting_on_failure:
+ return self.exit_on_failure_message
msg = self._get_message_before_teardown()
return self._get_message_after_teardown(msg)
def _get_message_before_teardown(self):
- if self.setup:
- return self.setup_failed % self.setup
- return self.test
+ if self.setup_failure:
+ return self.setup_message % self.setup_failure
+ return self.test_failure
def _get_message_after_teardown(self, msg):
- if not self.teardown:
+ if not self.teardown_failure:
return msg
if not msg:
- return self.teardown_failed % self.teardown
- return self.also_teardown_failed % (msg, self.teardown)
+ return self.teardown_message % self.teardown_failure
+ return self.also_teardown_message % (msg, self.teardown_failure)
+
+
+class TestMessage(_Message):
+ setup_message = 'Setup failed:\n%s'
+ teardown_message = 'Teardown failed:\n%s'
+ also_teardown_message = '%s\n\nAlso teardown failed:\n%s'
+ # TODO: Clean up error message below
+ exit_on_failure_message = 'Critical failure occurred and ExitOnFailure
option is in use'
+
+ def __init__(self, status):
+ _Message.__init__(self, status)
+ self.exiting_on_failure = status.exiting_on_failure
-class SuiteMessage(TestMessage):
- setup_failed = 'Suite setup failed:\n%s'
- teardown_failed = 'Suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso suite teardown failed:\n%s'
+class SuiteMessage(_Message):
+ setup_message = 'Suite setup failed:\n%s'
+ teardown_message = 'Suite teardown failed:\n%s'
+ also_teardown_message = '%s\n\nAlso suite teardown failed:\n%s'
class ParentMessage(SuiteMessage):
- setup_failed = 'Parent suite setup failed:\n%s'
- teardown_failed = 'Parent suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso parent suite teardown failed:\n%s'
+ setup_message = 'Parent suite setup failed:\n%s'
+ teardown_message = 'Parent suite teardown failed:\n%s'
+ also_teardown_message = '%s\n\nAlso parent suite teardown failed:\n%s'
def __init__(self, status):
- while status.parent_status and status.parent_status.failures:
- status = status.parent_status
+ while status.parent and status.parent.failures:
+ status = status.parent
SuiteMessage.__init__(self, status)
==============================================================================
Revision: 18c89aeeb849
Branch: default
Author: Pekka Klärck
Date: Wed May 29 04:40:29 2013
Log: Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=18c89aeeb849
Deleted:
/src/robot/new_running/failures.py
=======================================
--- /src/robot/new_running/failures.py Tue May 28 06:00:22 2013
+++ /dev/null
@@ -1,101 +0,0 @@
-# Copyright 2008-2012 Nokia Siemens Networks Oyj
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-class ExecutionStatus(object):
-
- def __init__(self, parent_status=None, test=False):
- self.parent_status = parent_status
- self.setup_failure = None
- self.test_failure = None
- self.teardown_failure = None
- self.teardown_allowed = False
- self._test = test
-
- def setup_executed(self, failure=None):
- if failure:
- self.setup_failure = unicode(failure)
- self.teardown_allowed = True
-
- def test_failed(self, failure):
- self.test_failure = unicode(failure)
-
- def teardown_executed(self, failure=None):
- if failure:
- self.teardown_failure = unicode(failure)
-
- @property
- def message(self):
- if self.parent_status and self.parent_status.failures:
- message = ParentMessage(self.parent_status)
- elif self._test:
- message = TestMessage(self)
- else:
- message = SuiteMessage(self)
- return unicode(message)
-
- @property
- def failures(self):
- return bool(self.parent_status and self.parent_status.failures or
- self.setup_failure or
- self.test_failure or
- self.teardown_failure)
-
- @property
- def status(self):
- return 'FAIL' if self.failures else 'PASS'
-
-
-class TestMessage(object):
- setup_failed = 'Setup failed:\n%s'
- teardown_failed = 'Teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso teardown failed:\n%s'
-
- def __init__(self, status):
- self.setup = status.setup_failure
- self.test = status.test_failure or ''
- self.teardown = status.teardown_failure
-
- def __unicode__(self):
- msg = self._get_message_before_teardown()
- return self._get_message_after_teardown(msg)
-
- def _get_message_before_teardown(self):
- if self.setup:
- return self.setup_failed % self.setup
- return self.test
-
- def _get_message_after_teardown(self, msg):
- if not self.teardown:
- return msg
- if not msg:
- return self.teardown_failed % self.teardown
- return self.also_teardown_failed % (msg, self.teardown)
-
-
-class SuiteMessage(TestMessage):
- setup_failed = 'Suite setup failed:\n%s'
- teardown_failed = 'Suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso suite teardown failed:\n%s'
-
-
-class ParentMessage(SuiteMessage):
- setup_failed = 'Parent suite setup failed:\n%s'
- teardown_failed = 'Parent suite teardown failed:\n%s'
- also_teardown_failed = '%s\n\nAlso parent suite teardown failed:\n%s'
-
- def __init__(self, status):
- while status.parent_status and status.parent_status.failures:
- status = status.parent_status
- SuiteMessage.__init__(self, status)
--
---
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.