5 new revisions:

Revision: eff2e322d262
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:16:00 2013
Log:      model.Tags: support __add__
http://code.google.com/p/robotframework/source/detail?r=eff2e322d262

Revision: 9fa1730bbfee
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:22:02 2013
Log:      new run: support for variable table in
http://code.google.com/p/robotframework/source/detail?r=9fa1730bbfee

Revision: 80a17960ee88
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:59:53 2013
Log:      new run: support directory suites
http://code.google.com/p/robotframework/source/detail?r=80a17960ee88

Revision: 663f49bd8897
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 04:10:42 2013
Log:      new run: build multiple suites
http://code.google.com/p/robotframework/source/detail?r=663f49bd8897

Revision: 3670a0ea40ad
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 04:24:24 2013
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=3670a0ea40ad

==============================================================================
Revision: eff2e322d262
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:16:00 2013
Log:      model.Tags: support __add__
http://code.google.com/p/robotframework/source/detail?r=eff2e322d262

Modified:
 /src/robot/model/tags.py
 /utest/model/test_tags.py

=======================================
--- /src/robot/model/tags.py    Thu May 16 04:15:53 2013
+++ /src/robot/model/tags.py    Fri May 17 03:16:00 2013
@@ -54,6 +54,9 @@
     def __getitem__(self, item):
         return self._tags[item]

+    def __add__(self, other):
+        return Tags(list(self) + list(Tags(other)))
+

 class TagPatterns(object):

=======================================
--- /utest/model/test_tags.py   Mon Nov 26 03:54:57 2012
+++ /utest/model/test_tags.py   Fri May 17 03:16:00 2013
@@ -20,6 +20,9 @@
                     ('', 'T 1', '', 't2', 't_3', 'NONE')]:
             assert_equal(list(Tags(inp)), ['T 1', 't2', 't_3'])

+    def test_init_with_none(self):
+        assert_equal(list(Tags(None)), [])
+
     def test_add_string(self):
         tags = Tags(['Y'])
         tags.add('x')
@@ -90,6 +93,30 @@
         assert_equal(str(Tags(['y', "X'X"])), "[X'X, y]")
         assert_equal(str(Tags([u'\xe4', 'a'])), '[a, \xc3\xa4]')

+    def test__add__list(self):
+        tags = Tags(['xx', 'yy'])
+        new_tags = tags + ['zz', 'ee', 'XX']
+        assert_true(isinstance(new_tags, Tags))
+        assert_equal(list(tags), ['xx', 'yy'])
+        assert_equal(list(new_tags), ['ee', 'xx', 'yy', 'zz'])
+
+    def test__add__tags(self):
+        tags1 = Tags(['xx', 'yy'])
+        tags2 = Tags(['zz', 'ee', 'XX'])
+        new_tags = tags1 + tags2
+        assert_true(isinstance(new_tags, Tags))
+        assert_equal(list(tags1), ['xx', 'yy'])
+        assert_equal(list(tags2), ['ee', 'XX', 'zz'])
+        assert_equal(list(new_tags), ['ee', 'xx', 'yy', 'zz'])
+
+    def test__add__list(self):
+        tags = Tags(['xx', 'yy'])
+        new_tags = tags + None
+        assert_true(isinstance(new_tags, Tags))
+        assert_equal(list(tags), ['xx', 'yy'])
+        assert_equal(list(new_tags), list(tags))
+        assert_true(new_tags is not tags)
+

 class TestTagPatterns(unittest.TestCase):


==============================================================================
Revision: 9fa1730bbfee
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:22:02 2013
Log:      new run: support for variable table in
http://code.google.com/p/robotframework/source/detail?r=9fa1730bbfee

Modified:
 /src/robot/model/criticality.py
 /src/robot/new_running/builder.py
 /src/robot/new_running/model.py
 /src/robot/new_running/runner.py
 /src/robot/running/namespace.py
 /utest/new_running/test_builder.py
 /utest/new_running/test_running.py
 /utest/running/test_namespace.py

=======================================
--- /src/robot/model/criticality.py     Fri Mar  9 04:54:09 2012
+++ /src/robot/model/criticality.py     Fri May 17 03:22:02 2013
@@ -34,3 +34,8 @@

     def __nonzero__(self):
         return bool(self.critical_tags or self.non_critical_tags)
+
+    # TODO: Remove compatibility with old Statistics
+    is_critical = tag_is_critical
+    is_non_critical = tag_is_non_critical
+
=======================================
--- /src/robot/new_running/builder.py   Thu May 16 06:01:41 2013
+++ /src/robot/new_running/builder.py   Fri May 17 03:22:02 2013
@@ -18,6 +18,13 @@
                                  name=imp.name,
                                  args=tuple(imp.args),
                                  alias=imp.alias)
+        for var_data in data.variable_table.variables:
+            if var_data.name.startswith('$'):
+                value = var_data.value[0]
+            else:
+                value = var_data.value
+            suite.variables.create(name=var_data.name,
+                                   value=value)
         for uk_data in data.keyword_table.keywords:
             uk = suite.user_keywords.create(name=uk_data.name,
                                             args=tuple(uk_data.args))
=======================================
--- /src/robot/new_running/model.py     Thu May 16 06:01:41 2013
+++ /src/robot/new_running/model.py     Fri May 17 03:22:02 2013
@@ -50,13 +50,13 @@
     __slots__ = []
     test_class = TestCase
     keyword_class = Keyword
-    variables = Variables()
     status = 'RUNNING'   # TODO: Remove compatibility

     def __init__(self, *args, **kwargs):
         model.TestSuite.__init__(self, *args, **kwargs)
         self.imports = []
         self.user_keywords = []
+        self.variables = []

     @setter
     def imports(self, imports):
@@ -66,6 +66,10 @@
     def user_keywords(self, keywords):
         return model.ItemList(UserKeyword, items=keywords)

+    @setter
+    def variables(self, variables):
+        return model.ItemList(Variable, items=variables)
+
     def randomize(self, suites=True, tests=True):
         self.visit(Randomizer(suites, tests))

@@ -76,6 +80,19 @@
         output.close(runner.result)
         return runner.result

+    # TODO: Remove compatibility with old model
+    def _set_critical_tags(self, arg):
+        pass
+    critical = None
+
+
+class Variable(object):
+
+    def __init__(self, name, value):
+        # TODO: check name and value
+        self.name = name
+        self.value = value
+

 class UserKeyword(object):

=======================================
--- /src/robot/new_running/runner.py    Thu May 16 06:01:41 2013
+++ /src/robot/new_running/runner.py    Fri May 17 03:22:02 2013
@@ -15,6 +15,7 @@
 from robot.model import SuiteVisitor
 from robot.result.testsuite import TestSuite # TODO: expose in __init__
 from robot.running.namespace import Namespace
+from robot.variables import Variables
 from robot.running.context import EXECUTION_CONTEXTS
 from robot.running.keywords import Keywords
 from robot.running.userkeyword import UserLibrary
@@ -33,7 +34,10 @@
             self.result = self.current = TestSuite(name=suite.name)
         else:
             self.current = self.current.suites.create(name=suite.name)
-        ns = Namespace(suite, None, UserLibrary(suite.user_keywords))
+        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)
         self.output.start_suite(self.current)
         ns.handle_imports()
@@ -43,7 +47,8 @@
         self.current = self.current.parent

     def visit_test(self, test):
-        result = self.current.tests.create(name=test.name)
+        result = self.current.tests.create(name=test.name,
+                                           tags=test.tags)
         keywords = Keywords(test.keywords.normal)
         self.context.start_test(result)
         try:
=======================================
--- /src/robot/running/namespace.py     Thu May 16 06:01:59 2013
+++ /src/robot/running/namespace.py     Fri May 17 03:22:02 2013
@@ -42,12 +42,12 @@
                              'OperatingSystem': 'DeprecatedOperatingSystem'}
_library_import_by_path_endings = ('.py', '.java', '.class', '/', os.sep)

-    def __init__(self, suite, parent_vars, user_keywords=None):
+ def __init__(self, suite, parent_vars, user_keywords=None, variables=None):
         if suite is not None:
LOGGER.info("Initializing namespace for test suite '%s'" % suite.longname)
-        self.variables = self._create_variables(suite, parent_vars)
         self.suite = suite
-        # TODO: Remove below compatibility with old/new running
+        # TODO: Remove variable and uk compatibility with old/new running
+ self.variables = self._create_variables(suite, parent_vars, variables) self._user_keywords = user_keywords if user_keywords is not None else suite.user_keywords
         self.test = None
         self.uk_handlers = []
@@ -60,8 +60,10 @@
         self._import_default_libraries()
         self._handle_imports(self.suite.imports)

-    def _create_variables(self, suite, parent_vars):
-        variables = _VariableScopes(suite, parent_vars)
+    def _create_variables(self, suite, parent_vars, suite_variables=None):
+        if suite_variables is None:
+            suite_variables = suite.variables
+        variables = _VariableScopes(suite_variables, parent_vars)
         variables['${SUITE_NAME}'] = suite.longname
         variables['${SUITE_SOURCE}'] = suite.source
         variables['${SUITE_DOCUMENTATION}'] = suite.doc
@@ -390,17 +392,17 @@

 class _VariableScopes:

-    def __init__(self, suite, parent_vars):
+    def __init__(self, suite_variables, parent_variables):
         # suite and parent are None only when used by copy_all
-        if suite is not None:
-            suite.variables.update(GLOBAL_VARIABLES)
-            self._suite = self.current = suite.variables
+        if suite_variables is not None:
+            suite_variables.update(GLOBAL_VARIABLES)
+            self._suite = self.current = suite_variables
         else:
             self._suite = self.current = None
         self._parents = []
-        if parent_vars is not None:
-            self._parents.append(parent_vars.current)
-            self._parents.extend(parent_vars._parents)
+        if parent_variables is not None:
+            self._parents.append(parent_variables.current)
+            self._parents.extend(parent_variables._parents)
         self._test = None
         self._uk_handlers = []

=======================================
--- /utest/new_running/test_builder.py  Thu May 16 06:01:41 2013
+++ /utest/new_running/test_builder.py  Fri May 17 03:22:02 2013
@@ -30,6 +30,13 @@
         assert_equals(imp.name, 'DummyLib')
         assert_equals(imp.args, ())

+    def test_variables(self):
+        variables = self._build('pass_and_fail.txt').variables
+        assert_equals(variables[0].name, '${LEVEL1}')
+        assert_equals(variables[0].value, 'INFO')
+        assert_equals(variables[1].name, '${LEVEL2}')
+        assert_equals(variables[1].value, 'DEBUG')
+
     def test_user_keywords(self):
         uk = self._build('pass_and_fail.txt').user_keywords[0]
         assert_equals(uk.name, 'My Keyword')
=======================================
--- /utest/new_running/test_running.py  Thu May 16 06:01:41 2013
+++ /utest/new_running/test_running.py  Fri May 17 03:22:02 2013
@@ -25,7 +25,7 @@
         test.keywords.create('Fail', args=['Hello, world!'])
         result = suite.run(output='NONE')
         self._check_suite(result, 'Suite', 'FAIL')
-        self._check_test(result.tests[0], 'Test', 'FAIL', 'Hello, world!')
+ self._check_test(result.tests[0], 'Test', 'FAIL', msg='Hello, world!')

     def test_assign(self):
         suite = TestSuite(name='Suite')
@@ -34,7 +34,7 @@
         test.keywords.create('Fail', args=['${var}'])
         result = suite.run(output='NONE')
         self._check_suite(result, 'Suite', 'FAIL')
- self._check_test(result.tests[0], 'Test', 'FAIL', 'value in variable') + self._check_test(result.tests[0], 'Test', 'FAIL', msg='value in variable')

     def test_suites_in_suites(self):
         root = TestSuite(name='Root')
@@ -62,14 +62,26 @@
         uk.keywords.create(name='Fail', args=['${msg}'])
         result = suite.run(output='NONE')
         self._check_suite(result, 'Suite', 'FAIL')
-        self._check_test(result.tests[0], 'Test', 'FAIL', 'From uk')
+        self._check_test(result.tests[0], 'Test', 'FAIL', msg='From uk')
+
+    def test_variables(self):
+        suite = TestSuite(name='Suite')
+        suite.variables.create('${ERROR}', 'Error message')
+        suite.variables.create('@{LIST}', ['Error', 'added tag'])
+ suite.tests.create(name='T1').keywords.create('Fail', args=['${ERROR}']) + suite.tests.create(name='T2').keywords.create('Fail', args=['@{LIST}'])
+        result = suite.run(output='NONE')
+        self._check_suite(result, 'Suite', 'FAIL', tests=2)
+ self._check_test(result.tests[0], 'T1', 'FAIL', msg='Error message') + self._check_test(result.tests[1], 'T2', 'FAIL', ('added tag',), 'Error')

     def _check_suite(self, suite, name, status, tests=1):
         assert_equals(suite.name, name)
         assert_equals(suite.status, status)
         assert_equals(len(suite.tests), tests)

-    def _check_test(self, test, name, status, message=''):
+    def _check_test(self, test, name, status, tags=(), msg=''):
         assert_equals(test.name, name)
         assert_equals(test.status, status)
-        assert_equals(test.message, message)
+        assert_equals(test.message, msg)
+        assert_equals(tuple(test.tags), tags)
=======================================
--- /utest/running/test_namespace.py    Sun Jan 29 02:08:21 2012
+++ /utest/running/test_namespace.py    Fri May 17 03:22:02 2013
@@ -20,12 +20,7 @@
 class TestVariableScopes(unittest.TestCase):

     def test_len(self):
+        variables = {'foo': 'bar', 'quuz': 'blaah'}
         assert_equals(len(_VariableScopes(None, None)), 0)
- assert_equals(len(_VariableScopes(DummySuite(), None)), 2 + len(GLOBAL_VARIABLES)) - assert_equals(len(_VariableScopes(None, _VariableScopes(DummySuite(), None))), 0)
-
-
-class DummySuite(object):
-
-    def __init__(self):
-        self.variables = {'foo': 'bar', 'quuz': 'blaah'}
+ assert_equals(len(_VariableScopes(variables, None)), 2 + len(GLOBAL_VARIABLES)) + assert_equals(len(_VariableScopes(None, _VariableScopes(variables, None))), 0)

==============================================================================
Revision: 80a17960ee88
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 03:59:53 2013
Log:      new run: support directory suites
http://code.google.com/p/robotframework/source/detail?r=80a17960ee88

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

=======================================
--- /src/robot/new_running/builder.py   Fri May 17 03:22:02 2013
+++ /src/robot/new_running/builder.py   Fri May 17 03:59:53 2013
@@ -9,7 +9,9 @@
         pass

     def build(self, path):
-        data = TestData(source=path)
+        return self._build(TestData(source=path))
+
+    def _build(self, data):
         suite = TestSuite(name=data.name,
                           source=data.source,
                           doc=data.setting_table.doc.value)
@@ -41,6 +43,8 @@
                 test.keywords.create(name=kw_data.keyword,
                                      args=tuple(kw_data.args),
                                      assign=tuple(kw_data.assign))
+        for child in data.children:
+            suite.suites.append(self._build(child))
         return suite

     def _get_tags(self, test, settings):
=======================================
--- /utest/new_running/test_builder.py  Fri May 17 03:22:02 2013
+++ /utest/new_running/test_builder.py  Fri May 17 03:59:53 2013
@@ -54,3 +54,14 @@
         assert_equals(kw.args, ('Pass',))
         assert_equals(kw.assign, ())
         assert_equals(kw.type, kw.KEYWORD_TYPE)
+
+    def test_directory_suite(self):
+        suite = self._build('suites')
+        assert_equals(suite.name, 'Suites')
+        assert_equals(suite.doc, '')
+        assert_equals(suite.metadata, {})
+        assert_equals(suite.suites[1].name, 'Subsuites')
+        assert_equals(suite.suites[-1].name, 'Tsuite3')
+        assert_equals(suite.suites[1].suites[1].name, 'Sub2')
+        assert_equals(len(suite.suites[1].suites[1].tests), 1)
+        assert_equals(suite.suites[1].suites[1].tests[0].id, 's1-s2-s2-t1')

==============================================================================
Revision: 663f49bd8897
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 04:10:42 2013
Log:      new run: build multiple suites
http://code.google.com/p/robotframework/source/detail?r=663f49bd8897

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

=======================================
--- /src/robot/new_running/builder.py   Fri May 17 03:59:53 2013
+++ /src/robot/new_running/builder.py   Fri May 17 04:10:42 2013
@@ -8,8 +8,13 @@
     def __init__(self):
         pass

-    def build(self, path):
-        return self._build(TestData(source=path))
+    def build(self, *paths):
+        if len(paths) == 1:
+            return self._build(TestData(source=paths[0]))
+        root = TestSuite()
+        for path in paths:
+            root.suites.append(self._build(TestData(source=path)))
+        return root

     def _build(self, data):
         suite = TestSuite(name=data.name,
=======================================
--- /src/robot/run.py   Thu May 16 04:15:53 2013
+++ /src/robot/run.py   Fri May 17 04:10:42 2013
@@ -386,7 +386,7 @@
                                        stderr=settings['StdErr'])
         init_global_variables(settings)
         from robot.new_running import TestSuiteBuilder
-        suite = TestSuiteBuilder().build(datasources[0])
+        suite = TestSuiteBuilder().build(*datasources)
         result = suite.run(**options)
         LOGGER.info("Tests execution ended. Statistics:\n%s"
                     % result.statistics.message)
=======================================
--- /utest/new_running/test_builder.py  Fri May 17 03:59:53 2013
+++ /utest/new_running/test_builder.py  Fri May 17 04:10:42 2013
@@ -11,11 +11,11 @@

 class TestBuilding(unittest.TestCase):

-    def _build(self, path):
-        path = join(DATADIR, path)
-        suite = TestSuiteBuilder().build(path)
+    def _build(self, *paths):
+        paths = [join(DATADIR, p) for p in paths]
+        suite = TestSuiteBuilder().build(*paths)
         assert_true(isinstance(suite, TestSuite))
-        assert_equals(suite.source, path)
+        assert_equals(suite.source, paths[0] if len(paths) == 1 else '')
         return suite

     def test_suite_data(self):
@@ -58,10 +58,15 @@
     def test_directory_suite(self):
         suite = self._build('suites')
         assert_equals(suite.name, 'Suites')
-        assert_equals(suite.doc, '')
-        assert_equals(suite.metadata, {})
         assert_equals(suite.suites[1].name, 'Subsuites')
         assert_equals(suite.suites[-1].name, 'Tsuite3')
         assert_equals(suite.suites[1].suites[1].name, 'Sub2')
         assert_equals(len(suite.suites[1].suites[1].tests), 1)
         assert_equals(suite.suites[1].suites[1].tests[0].id, 's1-s2-s2-t1')
+
+    def test_multiple_inputs(self):
+        suite = self._build('pass_and_fail.txt', 'normal.txt')
+        assert_equals(suite.name, 'Pass And Fail & Normal')
+        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')

==============================================================================
Revision: 3670a0ea40ad
Branch:   default
Author:   Robot Framework Developers ([email protected])
Date:     Fri May 17 04:24:24 2013
Log:      Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=3670a0ea40ad


--

--- 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.


Reply via email to