4 new revisions:
Revision: 3a66fe078df2
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 04:15:53 2013
Log: new run: started integration to normal execution
http://code.google.com/p/robotframework/source/detail?r=3a66fe078df2
Revision: 2d3e916dd563
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:15 2013
Log: api cleanup to make it easier to implement new running
http://code.google.com/p/robotframework/source/detail?r=2d3e916dd563
Revision: f964b308aed5
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:41 2013
Log: new runner: run tests with user keywords
http://code.google.com/p/robotframework/source/detail?r=f964b308aed5
Revision: a5ebf4373384
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:59 2013
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=a5ebf4373384
==============================================================================
Revision: 3a66fe078df2
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 04:15:53 2013
Log: new run: started integration to normal execution
http://code.google.com/p/robotframework/source/detail?r=3a66fe078df2
Modified:
/src/robot/model/tags.py
/src/robot/new_running/model.py
/src/robot/new_running/runner.py
/src/robot/result/testsuite.py
/src/robot/run.py
=======================================
--- /src/robot/model/tags.py Mon Nov 26 03:54:57 2012
+++ /src/robot/model/tags.py Thu May 16 04:15:53 2013
@@ -51,6 +51,9 @@
def __str__(self):
return unicode(self).encode('UTF-8')
+ def __getitem__(self, item):
+ return self._tags[item]
+
class TagPatterns(object):
=======================================
--- /src/robot/new_running/model.py Thu May 16 02:32:15 2013
+++ /src/robot/new_running/model.py Thu May 16 04:15:53 2013
@@ -73,8 +73,10 @@
self.visit(Randomizer(suites, tests))
def run(self, **options):
- runner = Runner(Output(RobotSettings(options)))
+ output = Output(RobotSettings(options))
+ runner = Runner(output)
self.visit(runner)
+ output.close(runner.result)
return runner.result
=======================================
--- /src/robot/new_running/runner.py Wed May 15 06:25:35 2013
+++ /src/robot/new_running/runner.py Thu May 16 04:15:53 2013
@@ -34,11 +34,17 @@
self.current = self.current.suites.create(name=suite.name)
ns = Namespace(suite, None)
self.context = EXECUTION_CONTEXTS.start_suite(ns, self.output,
False)
+ self.output.start_suite(self.current)
ns.handle_imports()
+ def end_suite(self, suite):
+ self.context.end_suite(self.current)
+ self.current = self.current.parent
+
def visit_test(self, test):
result = self.current.tests.create(name=test.name)
keywords = Keywords(test.keywords.normal)
+ self.context.start_test(result)
try:
keywords.run(self.context)
except ExecutionFailed, err:
@@ -46,3 +52,4 @@
result.status = 'FAIL'
else:
result.status = 'PASS'
+ self.context.end_test(result)
=======================================
--- /src/robot/result/testsuite.py Wed Jan 9 08:42:21 2013
+++ /src/robot/result/testsuite.py Thu May 16 04:15:53 2013
@@ -76,3 +76,11 @@
def filter_messages(self, log_level='TRACE'):
self.visit(MessageFilter(log_level))
+
+ # TODO: Remove compatibility code below when new run is integrated
+ def get_full_message(self):
+ return self.full_message
+
+ @property
+ def critical(self):
+ return self.criticality
=======================================
--- /src/robot/run.py Mon May 13 06:18:40 2013
+++ /src/robot/run.py Thu May 16 04:15:53 2013
@@ -350,6 +350,8 @@
def __init__(self):
Application.__init__(self, USAGE, arg_limits=(1,), logger=LOGGER)
+ if os.environ.get('NEWRUN'):
+ self.main = self.new_main
def main(self, datasources, **options):
STOP_SIGNAL_MONITOR.start()
@@ -372,6 +374,27 @@
ResultWriter(output).write_results(settings)
return suite.return_code
+ def new_main(self, datasources, **options):
+ STOP_SIGNAL_MONITOR.start()
+ namespace.IMPORTER.reset()
+ settings = RobotSettings(options)
+ pyloggingconf.initialize(settings['LogLevel'])
+ LOGGER.register_console_logger(width=settings['MonitorWidth'],
+ colors=settings['MonitorColors'],
+ markers=settings['MonitorMarkers'],
+ stdout=settings['StdOut'],
+ stderr=settings['StdErr'])
+ init_global_variables(settings)
+ from robot.new_running import TestSuiteBuilder
+ suite = TestSuiteBuilder().build(datasources[0])
+ result = suite.run(**options)
+ LOGGER.info("Tests execution ended. Statistics:\n%s"
+ % result.statistics.message)
+ if settings.is_rebot_needed():
+ output, settings = settings.get_rebot_datasource_and_settings()
+ ResultWriter(output).write_results(settings)
+ return min(result.statistics.critical.failed, 250)
+
def validate(self, options, arguments):
if len(arguments) > 1:
arguments = self._validate_arguments_exist(arguments)
==============================================================================
Revision: 2d3e916dd563
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:15 2013
Log: api cleanup to make it easier to implement new running
http://code.google.com/p/robotframework/source/detail?r=2d3e916dd563
Modified:
/src/robot/parsing/settings.py
/src/robot/running/model.py
/src/robot/running/namespace.py
/src/robot/running/userkeyword.py
/utest/running/test_userhandlers.py
=======================================
--- /src/robot/parsing/settings.py Thu May 16 02:32:15 2013
+++ /src/robot/parsing/settings.py Thu May 16 06:01:15 2013
@@ -77,6 +77,9 @@
def __nonzero__(self):
return self.is_set()
+ def __iter__(self):
+ return iter(self.value)
+
class StringValueJoiner(object):
@@ -108,6 +111,9 @@
def _data_as_list(self):
return [self.setting_name, self.value]
+ def __unicode__(self):
+ return self.value
+
class Template(Setting):
=======================================
--- /src/robot/running/model.py Fri May 10 04:32:46 2013
+++ /src/robot/running/model.py Thu May 16 06:01:15 2013
@@ -209,6 +209,7 @@
self.imports = []
self.setup = Setup(None, None)
self.teardown = Teardown(None, None)
+ self.user_keywords = None
for suite in suitedatas:
RunnableTestSuite(suite, self,
process_variables=process_variables)
self._exit_on_failure_mode = False
=======================================
--- /src/robot/running/namespace.py Wed May 15 04:51:47 2013
+++ /src/robot/running/namespace.py Thu May 16 06:01:15 2013
@@ -42,11 +42,13 @@
'OperatingSystem': 'DeprecatedOperatingSystem'}
_library_import_by_path_endings = ('.py', '.java', '.class', '/',
os.sep)
- def __init__(self, suite, parent_vars):
+ def __init__(self, suite, parent_vars, user_keywords=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
+ self._user_keywords = user_keywords if user_keywords is not None
else suite.user_keywords
self.test = None
self.uk_handlers = []
self.library_search_order = []
@@ -301,8 +303,8 @@
return None
def _get_handler_from_test_case_file_user_keywords(self, name):
- if self.suite.user_keywords.has_handler(name):
- return self.suite.user_keywords.get_handler(name)
+ if self._user_keywords.has_handler(name):
+ return self._user_keywords.get_handler(name)
def _get_handler_from_resource_file_user_keywords(self, name):
found = [lib.get_handler(name) for lib
=======================================
--- /src/robot/running/userkeyword.py Tue May 14 04:16:01 2013
+++ /src/robot/running/userkeyword.py Thu May 16 06:01:15 2013
@@ -109,12 +109,12 @@
def __init__(self, keyword, libname):
self.name = keyword.name
self.keywords = Keywords(keyword.steps)
- self.return_value = keyword.return_.value
+ self.return_value = tuple(keyword.return_)
self.teardown = keyword.teardown
self.libname = libname
- self.doc = self._doc = keyword.doc.value
+ self.doc = self._doc = unicode(keyword.doc)
self.arguments = UserKeywordArgumentParser().parse(self.longname,
-
keyword.args.value)
+
tuple(keyword.args))
self._timeout = keyword.timeout
@property
@@ -252,7 +252,7 @@
_variable_pattern = r'\$\{[^\}]+\}'
def __init__(self, keyword, libname):
- if keyword.args.value:
+ if keyword.args:
raise TypeError('Cannot have normal arguments')
self.embedded_args, self.name_regexp \
= self._read_embedded_args_and_regexp(keyword.name)
=======================================
--- /utest/running/test_userhandlers.py Mon Apr 29 06:04:45 2013
+++ /utest/running/test_userhandlers.py Thu May 16 06:01:15 2013
@@ -11,6 +11,9 @@
value = ''
message = ''
+ def __iter__(self):
+ return iter([])
+
class FakeArgs(object):
def __init__(self, args):
@@ -19,6 +22,9 @@
def __nonzero__(self):
return bool(self.value)
+ def __iter__(self):
+ return iter(self.value)
+
class HandlerDataMock:
==============================================================================
Revision: f964b308aed5
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:41 2013
Log: new runner: run tests with user keywords
http://code.google.com/p/robotframework/source/detail?r=f964b308aed5
Modified:
/src/robot/new_running/builder.py
/src/robot/new_running/model.py
/src/robot/new_running/runner.py
/utest/new_running/test_builder.py
/utest/new_running/test_running.py
=======================================
--- /src/robot/new_running/builder.py Thu May 16 02:32:15 2013
+++ /src/robot/new_running/builder.py Thu May 16 06:01:41 2013
@@ -18,6 +18,13 @@
name=imp.name,
args=tuple(imp.args),
alias=imp.alias)
+ for uk_data in data.keyword_table.keywords:
+ uk = suite.user_keywords.create(name=uk_data.name,
+ args=tuple(uk_data.args))
+ for kw_data in uk_data.steps:
+ uk.keywords.create(name=kw_data.keyword,
+ args=tuple(kw_data.args),
+ assign=tuple(kw_data.assign))
for test_data in data.testcase_table.tests:
test = suite.tests.create(name=test_data.name,
doc=test_data.doc.value,
=======================================
--- /src/robot/new_running/model.py Thu May 16 04:15:53 2013
+++ /src/robot/new_running/model.py Thu May 16 06:01:41 2013
@@ -16,6 +16,7 @@
from robot.output import Output
from robot.conf import RobotSettings
from robot.utils import setter
+from robot.variables import Variables
from .randomizer import Randomizer
from .runner import Runner
@@ -45,30 +46,26 @@
keyword_class = Keyword
-class UserKeywords(object):
-
- def has_handler(self, name):
- return False
-
-from robot.variables import Variables
-
-
class TestSuite(model.TestSuite):
__slots__ = []
test_class = TestCase
keyword_class = Keyword
variables = Variables()
- user_keywords = UserKeywords()
- status = 'RUNNING'
+ status = 'RUNNING' # TODO: Remove compatibility
def __init__(self, *args, **kwargs):
model.TestSuite.__init__(self, *args, **kwargs)
self.imports = []
+ self.user_keywords = []
@setter
def imports(self, imports):
return model.ItemList(Import, items=imports)
+ @setter
+ def user_keywords(self, keywords):
+ return model.ItemList(UserKeyword, items=keywords)
+
def randomize(self, suites=True, tests=True):
self.visit(Randomizer(suites, tests))
@@ -80,6 +77,32 @@
return runner.result
+class UserKeyword(object):
+
+ def __init__(self, name, args=(), doc='', return_=None):
+ self.name = name
+ self.args = args
+ self.doc = doc
+ self.return_ = return_ or ()
+ self.teardown = None
+ self.timeout = Timeout()
+ self.keywords = []
+
+ @setter
+ def keywords(self, keywords):
+ return model.ItemList(Keyword, items=keywords)
+
+ # TODO: Remove compatibility
+ @property
+ def steps(self):
+ return self.keywords
+
+
+class Timeout(object):
+ value = None
+ message = ''
+
+
class Import(object):
# TODO: Should type be verified?
=======================================
--- /src/robot/new_running/runner.py Thu May 16 04:15:53 2013
+++ /src/robot/new_running/runner.py Thu May 16 06:01:41 2013
@@ -16,7 +16,8 @@
from robot.result.testsuite import TestSuite # TODO: expose in __init__
from robot.running.namespace import Namespace
from robot.running.context import EXECUTION_CONTEXTS
-from robot.running.keywords import Keyword, Keywords
+from robot.running.keywords import Keywords
+from robot.running.userkeyword import UserLibrary
from robot.errors import ExecutionFailed
@@ -32,7 +33,7 @@
self.result = self.current = TestSuite(name=suite.name)
else:
self.current = self.current.suites.create(name=suite.name)
- ns = Namespace(suite, None)
+ ns = Namespace(suite, None, UserLibrary(suite.user_keywords))
self.context = EXECUTION_CONTEXTS.start_suite(ns, self.output,
False)
self.output.start_suite(self.current)
ns.handle_imports()
=======================================
--- /utest/new_running/test_builder.py Thu May 16 02:32:15 2013
+++ /utest/new_running/test_builder.py Thu May 16 06:01:41 2013
@@ -30,6 +30,11 @@
assert_equals(imp.name, 'DummyLib')
assert_equals(imp.args, ())
+ def test_user_keywords(self):
+ uk = self._build('pass_and_fail.txt').user_keywords[0]
+ assert_equals(uk.name, 'My Keyword')
+ assert_equals(uk.args, ('${who}',))
+
def test_test_data(self):
test = self._build('pass_and_fail.txt').tests[1]
assert_equals(test.name, 'Fail')
=======================================
--- /utest/new_running/test_running.py Wed May 15 06:25:35 2013
+++ /utest/new_running/test_running.py Thu May 16 06:01:41 2013
@@ -2,6 +2,10 @@
from robot.utils.asserts import assert_equals
from robot.new_running import TestSuite
+from robot.output import LOGGER
+
+
+LOGGER.disable_automatic_console_logger()
class TestRunning(unittest.TestCase):
@@ -51,6 +55,15 @@
self._check_suite(result, 'Suite', 'PASS')
self._check_test(result.tests[0], 'Test', 'PASS')
+ def test_user_keywords(self):
+ suite = TestSuite(name='Suite')
+ suite.tests.create(name='Test').keywords.create('User keyword',
args=['From uk'])
+ uk = suite.user_keywords.create(name='User keyword',
args=['${msg}'])
+ 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')
+
def _check_suite(self, suite, name, status, tests=1):
assert_equals(suite.name, name)
assert_equals(suite.status, status)
@@ -60,4 +73,3 @@
assert_equals(test.name, name)
assert_equals(test.status, status)
assert_equals(test.message, message)
-
==============================================================================
Revision: a5ebf4373384
Branch: default
Author: Robot Framework Developers ([email protected])
Date: Thu May 16 06:01:59 2013
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=a5ebf4373384
Modified:
/src/robot/running/namespace.py
=======================================
--- /src/robot/running/namespace.py Thu May 16 05:55:19 2013
+++ /src/robot/running/namespace.py Thu May 16 06:01:59 2013
@@ -42,11 +42,13 @@
'OperatingSystem': 'DeprecatedOperatingSystem'}
_library_import_by_path_endings = ('.py', '.java', '.class', '/',
os.sep)
- def __init__(self, suite, parent_vars):
+ def __init__(self, suite, parent_vars, user_keywords=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
+ self._user_keywords = user_keywords if user_keywords is not None
else suite.user_keywords
self.test = None
self.uk_handlers = []
self.library_search_order = []
@@ -301,8 +303,8 @@
return None
def _get_handler_from_test_case_file_user_keywords(self, name):
- if self.suite.user_keywords.has_handler(name):
- return self.suite.user_keywords.get_handler(name)
+ if self._user_keywords.has_handler(name):
+ return self._user_keywords.get_handler(name)
def _get_handler_from_resource_file_user_keywords(self, name):
found = [lib.get_handler(name) for lib
--
---
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.