Author: pekka.klarck
Date: Thu Mar 26 15:20:18 2009
New Revision: 1554

Modified:
   trunk/src/robot/__init__.py
   trunk/src/robot/conf/settings.py
   trunk/src/robot/output/output.py
   trunk/src/robot/output/systemlogger.py

Log:
cleanup

Modified: trunk/src/robot/__init__.py
==============================================================================
--- trunk/src/robot/__init__.py (original)
+++ trunk/src/robot/__init__.py Thu Mar 26 15:20:18 2009
@@ -34,9 +34,11 @@


 def run_from_cli(args, usage):
+    SYSLOG.info(utils.get_full_version('Robot Framework'))
     _run_or_rebot_from_cli(run, args, usage, pythonpath='pythonpath')

 def rebot_from_cli(args, usage):
+    SYSLOG.info(utils.get_full_version('Rebot'))
     _run_or_rebot_from_cli(rebot, args, usage)

 def _run_or_rebot_from_cli(method, cliargs, usage, **argparser_config):
@@ -53,6 +55,7 @@
         SYSLOG.register_console_logger()
         _exit(DATA_ERROR, str(err))

+    SYSLOG.info('Data sources: %s' % utils.seq2str(datasources))
     try:
         suite = method(*datasources, **options)
     except DataError:
@@ -86,13 +89,12 @@
                                    settings['MonitorColors'])
     output = Output(settings)
     init_global_variables(settings)
-    _syslog_start_info('Robot', datasources, settings)
     suite = TestSuite(datasources, settings)
     suite.run(output)
     SYSLOG.info("Tests execution ended. Statistics:\n%s"
                 % suite.get_stat_message())
     testoutput = RobotTestOutput(suite, settings)
-    output.close1(suite)
+    output.close(suite)
     if settings.is_rebot_needed():
datasources, settings = settings.get_rebot_datasources_and_settings()
         if settings['SplitOutputs'] > 0:
@@ -100,7 +102,7 @@
         else:
             testoutput = RebotTestOutput(datasources, settings)
         testoutput.serialize(settings)
-    output.close2()
+    SYSLOG.close()
     return suite


@@ -122,19 +124,11 @@
     settings = RebotSettings(options)
     SYSLOG.register_console_logger(colors=settings['MonitorColors'])
     SYSLOG.disable_message_cache()
-    _syslog_start_info('Rebot', datasources, settings)
     testoutput = RebotTestOutput(datasources, settings)
     testoutput.serialize(settings, generator='Rebot')
     SYSLOG.close()
     return testoutput.suite

-
-def _syslog_start_info(who, sources, settings):
-    SYSLOG.info(utils.get_full_version(who))
-    SYSLOG.info('Settings:\n%s' % settings)
-    SYSLOG.info('Starting processing data source%s %s'
-                % (utils.plural_or_not(sources), utils.seq2str(sources)))
-

 def _exit(rc_or_suite, message=None, details=None):
     """Exits with given rc or rc from given output. Syslogs error if given.

Modified: trunk/src/robot/conf/settings.py
==============================================================================
--- trunk/src/robot/conf/settings.py    (original)
+++ trunk/src/robot/conf/settings.py    Thu Mar 26 15:20:18 2009
@@ -61,11 +61,12 @@
     _deprecated = { 'colormonitor'   : 'monitorcolors',
                     'transform'      : None }

-    def __init__(self, opts={}):
+    def __init__(self, options={}, log=True):
         self._opts = {}
         self._cli_opts.update(self._extra_cli_opts)
-        self._process_deprecated_cli_opts(opts)
-        self._process_cli_opts(opts)
+        self._process_deprecated_cli_opts(options)
+        self._process_cli_opts(options)
+        if log: SYSLOG.info('Settings:\n%s' % self)

     def _process_cli_opts(self, opts):
         for name, (cli_name, default) in self._cli_opts.items():
@@ -221,7 +222,7 @@

     def get_rebot_datasources_and_settings(self):
         datasources = [ self['Output'] ]
-        settings = RebotSettings()
+        settings = RebotSettings(log=False)
         settings._opts = self._opts.copy()
         for name in ['Variables', 'VariableFiles', 'Listeners']:
             del(settings._opts[name])

Modified: trunk/src/robot/output/output.py
==============================================================================
--- trunk/src/robot/output/output.py    (original)
+++ trunk/src/robot/output/output.py    Thu Mar 26 15:20:18 2009
@@ -43,7 +43,7 @@
     def _get_log_name_generator(self, log):
         return log != 'NONE' and utils.FileNameGenerator(log) or None

-    def close1(self, suite):
+    def close(self, suite):
         stats = Statistics(suite, self._settings['SuiteStatLevel'],
                            self._settings['TagStatInclude'],
                            self._settings['TagStatExclude'],
@@ -57,11 +57,7 @@
             SYSLOG.output_file('Debug', self._debugfile.path)
             self._debugfile.close()

-    def close2(self):
-        SYSLOG.close()  # TODO: move!
-
     def start_suite(self, suite):
- SYSLOG.info("Running test suite '%s'" % suite.longname) # TODO: move!
         SYSLOG.start_suite(suite)
         if self.xmllogger.started_output:
             suite.namespace.variables.set_global('${OUTPUT_FILE}',
@@ -91,7 +87,6 @@
suite.namespace.variables.set_global('${LOG_FILE}', self._namegen.get_base())

     def start_test(self, test):
-        SYSLOG.info("Running test case '%s'" % test.name)
         SYSLOG.start_test(test)
         if self._debugfile is not None:
             self._debugfile.start_test(test)

Modified: trunk/src/robot/output/systemlogger.py
==============================================================================
--- trunk/src/robot/output/systemlogger.py      (original)
+++ trunk/src/robot/output/systemlogger.py      Thu Mar 26 15:20:18 2009
@@ -131,6 +131,24 @@
entry = '%s | %s | %s\n' % (message.timestamp, message.level.ljust(5),
                                     message.message)
         self._writer.write(utils.unic(entry).encode('UTF-8'))
+
+    def start_suite(self, suite):
+        self.info("Started test suite '%s'" % suite.name)
+
+    def end_suite(self, suite):
+        self.info("Ended test suite '%s'" % suite.name)
+
+    def start_test(self, test):
+        self.info("Started test case '%s'" % test.name)
+
+    def end_test(self, test):
+        self.info("Ended test case '%s'" % test.name)
+
+    def start_keyword(self, kw):
+        self.debug("Started keyword '%s'" % kw.name)
+
+    def end_keyword(self, kw):
+        self.debug("Ended keywordt '%s'" % kw.name)

     def output_file(self, name, path):
         self.info('%s: %s' % (name, path))

Reply via email to