3 new revisions:

Revision: 2d340c183f19
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 04:40:25 2013
Log:      new run: more data to result objects
http://code.google.com/p/robotframework/source/detail?r=2d340c183f19

Revision: f89507aef4d7
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 05:36:56 2013
Log:      new run: initial support for setups and teardowns
http://code.google.com/p/robotframework/source/detail?r=f89507aef4d7

Revision: 13f28f445519
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 05:37:03 2013
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=13f28f445519

==============================================================================
Revision: 2d340c183f19
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 04:40:25 2013
Log:      new run: more data to result objects
http://code.google.com/p/robotframework/source/detail?r=2d340c183f19

Modified:
 /src/robot/model/itemlist.py
 /src/robot/new_running/runner.py

=======================================
--- /src/robot/model/itemlist.py        Tue Mar  6 00:46:30 2012
+++ /src/robot/model/itemlist.py        Fri May 17 04:40:25 2013
@@ -30,6 +30,7 @@
     def append(self, item):
         self._check_type_and_set_attrs(item)
         self._items.append(item)
+        return item

     def _check_type_and_set_attrs(self, item):
         if not isinstance(item, self._item_class):
=======================================
--- /src/robot/new_running/runner.py    Fri May 17 03:22:02 2013
+++ /src/robot/new_running/runner.py    Fri May 17 04:40:25 2013
@@ -20,6 +20,7 @@
 from robot.running.keywords import Keywords
 from robot.running.userkeyword import UserLibrary
 from robot.errors import ExecutionFailed
+from robot import utils


 class Runner(SuiteVisitor):
@@ -30,10 +31,15 @@
         self.current = None

     def start_suite(self, suite):
+        result = TestSuite(name=suite.name,
+                           doc=suite.doc,
+                           metadata=suite.metadata,
+                           source=suite.source,
+                           starttime=utils.get_timestamp())
         if not self.result:
-            self.result = self.current = TestSuite(name=suite.name)
+            self.result = self.current = result
         else:
-            self.current = self.current.suites.create(name=suite.name)
+            self.current = self.current.suites.append(suite)
         vars = Variables()
         for var in suite.variables:
             vars[var.name] = var.value
@@ -43,12 +49,15 @@
         ns.handle_imports()

     def end_suite(self, suite):
+        self.current.endtime = utils.get_timestamp()
         self.context.end_suite(self.current)
         self.current = self.current.parent

     def visit_test(self, test):
         result = self.current.tests.create(name=test.name,
-                                           tags=test.tags)
+                                           doc=test.doc,
+                                           tags=test.tags,
+                                           starttime=utils.get_timestamp())
         keywords = Keywords(test.keywords.normal)
         self.context.start_test(result)
         try:
@@ -58,4 +67,5 @@
             result.status = 'FAIL'
         else:
             result.status = 'PASS'
+        result.endtime = utils.get_timestamp()
         self.context.end_test(result)

==============================================================================
Revision: f89507aef4d7
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 05:36:56 2013
Log:      new run: initial support for setups and teardowns
http://code.google.com/p/robotframework/source/detail?r=f89507aef4d7

Modified:
 /src/robot/new_running/builder.py
 /src/robot/new_running/runner.py
 /utest/new_running/test_builder.py

=======================================
--- /src/robot/new_running/builder.py   Fri May 17 04:10:42 2013
+++ /src/robot/new_running/builder.py   Fri May 17 05:36:56 2013
@@ -25,6 +25,16 @@
                                  name=imp.name,
                                  args=tuple(imp.args),
                                  alias=imp.alias)
+        suite_setup = data.setting_table.suite_setup
+        if suite_setup:
+            suite.keywords.create(type='setup',
+                                  name=suite_setup.name,
+                                  args=tuple(suite_setup.args))
+        suite_teardown = data.setting_table.suite_teardown
+        if suite_teardown:
+            suite.keywords.create(type='teardown',
+                                  name=suite_teardown.name,
+                                  args=tuple(suite_teardown.args))
         for var_data in data.variable_table.variables:
             if var_data.name.startswith('$'):
                 value = var_data.value[0]
@@ -44,10 +54,20 @@
                                       doc=test_data.doc.value,
                                       tags=self._get_tags(test_data,
data.setting_table)) + test_setup = test_data.setup or test_data.parent.parent.setting_table.test_setup
+            if test_setup:
+                test.keywords.create(type='setup',
+                                     name=test_setup.name,
+                                     args=tuple(test_setup.args))
             for kw_data in test_data.steps:
                 test.keywords.create(name=kw_data.keyword,
                                      args=tuple(kw_data.args),
                                      assign=tuple(kw_data.assign))
+ test_teardown = test_data.teardown or test_data.parent.parent.setting_table.test_teardown
+            if test_teardown:
+                test.keywords.create(type='teardown',
+                                     name=test_teardown.name,
+                                     args=tuple(test_teardown.args))
         for child in data.children:
             suite.suites.append(self._build(child))
         return suite
=======================================
--- /src/robot/new_running/runner.py    Fri May 17 04:40:25 2013
+++ /src/robot/new_running/runner.py    Fri May 17 05:36:56 2013
@@ -18,6 +18,7 @@
 from robot.variables import Variables
 from robot.running.context import EXECUTION_CONTEXTS
 from robot.running.keywords import Keywords
+from robot.running.fixture import Setup, Teardown
 from robot.running.userkeyword import UserLibrary
 from robot.errors import ExecutionFailed
 from robot import utils
@@ -30,6 +31,10 @@
         self.result = None
         self.current = None

+    @property
+    def context(self):
+        return EXECUTION_CONTEXTS.current
+
     def start_suite(self, suite):
         result = TestSuite(name=suite.name,
                            doc=suite.doc,
@@ -39,16 +44,21 @@
         if not self.result:
             self.result = self.current = result
         else:
-            self.current = self.current.suites.append(suite)
+            self.current = self.current.suites.append(result)
         vars = Variables()
         for var in suite.variables:
             vars[var.name] = var.value
-        ns = Namespace(suite, None, UserLibrary(suite.user_keywords), vars)
- self.context = EXECUTION_CONTEXTS.start_suite(ns, self.output, False)
+        ns = Namespace(suite,
+ self.context.namespace.variables if self.context else None,
+                       UserLibrary(suite.user_keywords),
+                       vars)
+        EXECUTION_CONTEXTS.start_suite(ns, self.output, False)
         self.output.start_suite(self.current)
         ns.handle_imports()
+        self._setup(suite.keywords.setup).run(self.context)

     def end_suite(self, suite):
+        self._teardown(suite.keywords.teardown).run(self.context)
         self.current.endtime = utils.get_timestamp()
         self.context.end_suite(self.current)
         self.current = self.current.parent
@@ -58,8 +68,11 @@
                                            doc=test.doc,
                                            tags=test.tags,
                                            starttime=utils.get_timestamp())
+        setup = self._setup(test.keywords.setup)
         keywords = Keywords(test.keywords.normal)
+        teardown = self._teardown(test.keywords.teardown)
         self.context.start_test(result)
+        setup.run(self.context)
         try:
             keywords.run(self.context)
         except ExecutionFailed, err:
@@ -67,5 +80,20 @@
             result.status = 'FAIL'
         else:
             result.status = 'PASS'
+        teardown.run(self.context)
         result.endtime = utils.get_timestamp()
         self.context.end_test(result)
+
+    def _setup(self, setup):
+        if not setup:
+            return Setup('', ())
+        setup = Setup(setup.name, setup.args)
+        setup.replace_variables(self.context.namespace.variables, [])
+        return setup
+
+    def _teardown(self, teardown):
+        if not teardown:
+            return Teardown('', ())
+        teardown = Teardown(teardown.name, teardown.args)
+        teardown.replace_variables(self.context.namespace.variables, [])
+        return teardown
=======================================
--- /utest/new_running/test_builder.py  Fri May 17 04:10:42 2013
+++ /utest/new_running/test_builder.py  Fri May 17 05:36:56 2013
@@ -70,3 +70,15 @@
         assert_equals(suite.suites[0].name, 'Pass And Fail')
         assert_equals(suite.suites[1].name, 'Normal')
         assert_equals(suite.suites[1].tests[1].id, 's1-s2-t2')
+
+    def test_suite_setup_and_teardown(self):
+        suite = self._build('setups_and_teardowns.txt')
+        assert_equals(suite.keywords.setup.name, 'Suite Setup')
+        assert_equals(suite.keywords.teardown.name, 'Suite Teardown')
+
+    def test_test_setup_and_teardown(self):
+        test = self._build('setups_and_teardowns.txt').tests[0]
+        assert_equals(test.keywords.setup.name, 'Test Setup')
+        assert_equals(test.keywords.teardown.name, 'Test Teardown')
+        assert_equals([kw.name for kw in test.keywords],
+                      ['Test Setup', 'Keyword', 'Test Teardown'])

==============================================================================
Revision: 13f28f445519
Branch:   default
Author:   Robot Framework Developers (robotframew...@gmail.com)
Date:     Fri May 17 05:37:03 2013
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=13f28f445519


--

--- 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 robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to