3 new revisions:

Revision: 7eb07ae2d39d
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:52:20 2011
Log:      use existing factory instead of duplicating if
http://code.google.com/p/robotframework/source/detail?r=7eb07ae2d39d

Revision: fed719747403
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:52:56 2011
Log:      parsing: decouple creation and populating of model objects
http://code.google.com/p/robotframework/source/detail?r=fed719747403

Revision: 62c6d6d76757
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:53:18 2011
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=62c6d6d76757

==============================================================================
Revision: 7eb07ae2d39d
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:52:20 2011
Log:      use existing factory instead of duplicating if
http://code.google.com/p/robotframework/source/detail?r=7eb07ae2d39d

Modified:
 /src/robot/parsing/__init__.py
 /src/robot/running/model.py

=======================================
--- /src/robot/parsing/__init__.py      Sun Feb  6 01:24:10 2011
+++ /src/robot/parsing/__init__.py      Thu Aug 11 23:52:20 2011
@@ -13,5 +13,5 @@
 #  limitations under the License.

 from datarow import DataRow
-from model import (TestCaseFile, TestDataDirectory, ResourceFile,
+from model import (TestData, TestCaseFile, TestDataDirectory, ResourceFile,
                    TestCase, UserKeyword)
=======================================
--- /src/robot/running/model.py Fri Jul 22 01:51:13 2011
+++ /src/robot/running/model.py Thu Aug 11 23:52:20 2011
@@ -16,7 +16,7 @@

 from robot import utils
 from robot.common import BaseTestSuite, BaseTestCase
-from robot.parsing import TestCaseFile, TestDataDirectory
+from robot.parsing import TestData
 from robot.errors import ExecutionFailed, DataError
 from robot.variables import GLOBAL_VARIABLES
 from robot.output import LOGGER
@@ -47,9 +47,7 @@

 def _parse_suite(path, include_suites, warn_on_skipped):
     try:
-        if os.path.isdir(path):
- return TestDataDirectory(source=path, include_suites=include_suites, warn_on_skipped=warn_on_skipped)
-        return TestCaseFile(source=path)
+ return TestData(source=path, include_suites=include_suites, warn_on_skipped=warn_on_skipped)
     except DataError, err:
         raise DataError("Parsing '%s' failed: %s" % (path, unicode(err)))


==============================================================================
Revision: fed719747403
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:52:56 2011
Log:      parsing: decouple creation and populating of model objects
http://code.google.com/p/robotframework/source/detail?r=fed719747403

Modified:
 /src/robot/parsing/model.py
 /src/robot/running/__init__.py
 /src/robot/running/importer.py

=======================================
--- /src/robot/parsing/model.py Thu Jun 16 05:36:58 2011
+++ /src/robot/parsing/model.py Thu Aug 11 23:52:56 2011
@@ -26,8 +26,8 @@

def TestData(parent=None, source=None, include_suites=[], warn_on_skipped=False):
     if os.path.isdir(source):
- return TestDataDirectory(parent, source, include_suites, warn_on_skipped)
-    return TestCaseFile(parent, source)
+ return TestDataDirectory(parent, source).populate(include_suites, warn_on_skipped)
+    return TestCaseFile(parent, source).populate()


 class _TestData(object):
@@ -102,9 +102,11 @@
         self.variable_table = VariableTable(self)
         self.testcase_table = TestCaseTable(self)
         self.keyword_table = KeywordTable(self)
-        if source: # FIXME: model should be decoupled from populating
-            FromFilePopulator(self).populate(source)
-            self._validate()
+
+    def populate(self):
+        FromFilePopulator(self).populate(self.source)
+        self._validate()
+        return self

     def _validate(self):
         if not self.testcase_table.is_started():
@@ -131,9 +133,11 @@
         self.variable_table = VariableTable(self)
         self.testcase_table = TestCaseTable(self)
         self.keyword_table = KeywordTable(self)
-        if self.source:
-            FromFilePopulator(self).populate(source)
-            self._report_status()
+
+    def populate(self):
+        FromFilePopulator(self).populate(self.source)
+        self._report_status()
+        return self

     def _report_status(self):
         if self.setting_table or self.variable_table or self.keyword_table:
@@ -156,7 +160,7 @@

 class TestDataDirectory(_TestData):

- def __init__(self, parent=None, source=None, include_suites=[], warn_on_skipped=False):
+    def __init__(self, parent=None, source=None):
         _TestData.__init__(self, parent, source)
         self.directory = self.source
         self.initfile = None
@@ -164,9 +168,11 @@
         self.variable_table = VariableTable(self)
         self.testcase_table = TestCaseTable(self)
         self.keyword_table = KeywordTable(self)
-        if self.source:
- FromDirectoryPopulator().populate(self.source, self, include_suites, warn_on_skipped) - self.children = [ ch for ch in self.children if ch.has_tests() ]
+
+    def populate(self, include_suites, warn_on_skipped):
+ FromDirectoryPopulator().populate(self.source, self, include_suites, warn_on_skipped)
+        self.children = [ ch for ch in self.children if ch.has_tests() ]
+        return self

     def _get_basename(self):
         return os.path.basename(self.source)
=======================================
--- /src/robot/running/__init__.py      Sun Feb  6 01:24:10 2011
+++ /src/robot/running/__init__.py      Thu Aug 11 23:52:56 2011
@@ -29,7 +29,7 @@
     from arguments import UserKeywordArguments
     from userkeyword import UserLibrary as RuntimeUserLibrary

-    resource = ResourceFile(path)
+    resource = ResourceFile(path).populate()
     ret = RuntimeUserLibrary(resource.keyword_table.keywords, path)
for handler in ret.handlers.values(): # This is done normally only at runtime.
         handler.arguments = UserKeywordArguments(handler._keyword_args,
=======================================
--- /src/robot/running/importer.py      Thu Jun 16 12:12:51 2011
+++ /src/robot/running/importer.py      Thu Aug 11 23:52:56 2011
@@ -42,7 +42,7 @@
         if path in self._resource_cache:
             LOGGER.info("Found resource file '%s' from cache" % path)
         else:
-            resource = ResourceFile(path)
+            resource = ResourceFile(path).populate()
             self._resource_cache[path] = resource
         return self._resource_cache[path]


==============================================================================
Revision: 62c6d6d76757
Author:   Janne Härkönen <[email protected]>
Date:     Thu Aug 11 23:53:18 2011
Log:      merge
http://code.google.com/p/robotframework/source/detail?r=62c6d6d76757


Reply via email to