Author: janne.t.harkonen
Date: Tue Nov 18 05:50:35 2008
New Revision: 992

Modified:
   trunk/src/robot/common/keyword.py
   trunk/src/robot/common/model.py
   trunk/src/robot/libraries/BuiltIn.py
   trunk/src/robot/running/handlers.py
   trunk/src/robot/running/model.py
   trunk/tools/libdoc/libdoc.py

Log:
removed state attribute from suites and tests (use status instead)

Modified: trunk/src/robot/common/keyword.py
==============================================================================
--- trunk/src/robot/common/keyword.py   (original)
+++ trunk/src/robot/common/keyword.py   Tue Nov 18 05:50:35 2008
@@ -24,7 +24,7 @@
         self.doc = doc
         self.timeout = timeout
         self.type = type
-        self.status = 'NOT_EXECUTED'
+        self.status = 'NOT_RUN'

     def serialize(self, serializer):
         serializer.start_keyword(self)

Modified: trunk/src/robot/common/model.py
==============================================================================
--- trunk/src/robot/common/model.py     (original)
+++ trunk/src/robot/common/model.py     Tue Nov 18 05:50:35 2008
@@ -26,7 +26,7 @@
         self.name = name
         self.setup = None
         self.teardown = None
-        self.status = 'NOT_EXECUTED'
+        self.status = 'NOT_RUN'

     def __getattr__(self, name):
         if name == 'htmldoc':
@@ -325,7 +325,6 @@

     def __init__(self, name=''):
         _TestAndSuiteHelper.__init__(self, name)
-        self.state = 'NOTRUN'
         self.critical = 'yes'

     def suite_teardown_failed(self, message):

Modified: trunk/src/robot/libraries/BuiltIn.py
==============================================================================
--- trunk/src/robot/libraries/BuiltIn.py        (original)
+++ trunk/src/robot/libraries/BuiltIn.py        Tue Nov 18 05:50:35 2008
@@ -882,7 +882,7 @@

     def _get_test_in_teardown(self, kwname):
         test = NAMESPACES.current.test
-        if test is not None and test.state == 'TEARDOWN':
+        if test is not None and test.state != 'RUNNING':
             return test
         raise DataError("Keyword '%s' can only be used in test teardown"
                         % kwname)
@@ -942,11 +942,10 @@
             return self.run_keyword(name, *args)

     def _get_suite_in_teardown(self, kwname):
-        suite = NAMESPACES.current.suite
-        if suite.state == 'TEARDOWN':
-            return suite
-        raise DataError("Keyword '%s' can only be used in suite teardown"
-                        % kwname)
+        if NAMESPACES.current.suite.state == 'RUNNING':
+ raise DataError("Keyword '%s' can only be used in suite teardown"
+                            % kwname)
+        return NAMESPACES.current.suite


 class Misc:
@@ -1295,7 +1294,7 @@
         if not (suite or test):
             ns = NAMESPACES.current
             if ns.test is None:
-                if ns.suite.state == 'TEARDOWN':
+                if ns.suite.status != 'RUNNING':
raise RuntimeError("'Set Tags' and 'Remove Tags' keywords "
                                        "cannot be used in suite teardown.")
                 self._set_or_remove_tags(handler, suite=ns.suite)

Modified: trunk/src/robot/running/handlers.py
==============================================================================
--- trunk/src/robot/running/handlers.py (original)
+++ trunk/src/robot/running/handlers.py Tue Nov 18 05:50:35 2008
@@ -117,7 +117,7 @@

     def _get_timeoutable_items(self, namespace):
         items = namespace.uk_handlers[:]
- if namespace.test is not None and namespace.test.state != 'TEARDOWN': + if namespace.test is not None and namespace.test.status == 'RUNNING':
             items.append(namespace.test)
         return items


Modified: trunk/src/robot/running/model.py
==============================================================================
--- trunk/src/robot/running/model.py    (original)
+++ trunk/src/robot/running/model.py    Tue Nov 18 05:50:35 2008
@@ -61,7 +61,7 @@
         self.namespace.variables['${SUITE_NAME}'] = self.longname
         init_err = self._init_suite(self.namespace.variables)
         output.start_suite(self)
-        self.state = 'RUN'
+        self.status = 'RUNNING'
setup_err = self._run_fixture(self.setup, output, self.namespace, error, init_err)
         child_err = self._get_child_error(error, init_err, setup_err)
         for suite in self.suites:
@@ -78,7 +78,6 @@
         self.message = self._get_my_error(error, init_err, setup_err)
         self.namespace.variables['${SUITE_STATUS}'] = self.status
self.namespace.variables['${SUITE_MESSAGE}'] = self.get_full_message()
-        self.state = 'TEARDOWN'
teardown_err = self._run_fixture(self.teardown, output, self.namespace,
                                          error, init_err)
         if teardown_err is not None:
@@ -187,7 +186,7 @@
     def _run(self, output, namespace):
         namespace.variables['${TEST_NAME}'] = self.name
         namespace.variables['@{TEST_TAGS}'] = self.tags
-        self.state = 'RUN'
+        self.status = 'RUNNING'
         self.timeout.start()
         setup_err = self._run_fixture(self.setup, output, namespace)
         kw_err = self._run_keywords(output, namespace, setup_err)
@@ -195,9 +194,7 @@
         self.status = self.message == '' and 'PASS' or 'FAIL'
         namespace.variables['${TEST_STATUS}'] = self.status
         namespace.variables['${TEST_MESSAGE}'] = self.message
-        self.state = 'TEARDOWN'
         teardown_err = self._run_fixture(self.teardown, output, namespace)
-        self.state = 'DONE'
         if teardown_err is not None:
self.message = self._get_message_with_teardown_err(self.message, teardown_err)

Modified: trunk/tools/libdoc/libdoc.py
==============================================================================
--- trunk/tools/libdoc/libdoc.py        (original)
+++ trunk/tools/libdoc/libdoc.py        Tue Nov 18 05:50:35 2008
@@ -70,11 +70,10 @@
 def process_arguments(args_list):
     argparser = utils.ArgumentParser(__doc__)
     try:
- opts, args = argparser.parse_args(args_list, pythonpath='pythonpath',
-                                          check_args=True)
-    except DataError:
-        exit(error=__doc__)
-    if opts['help']:
+ opts, args = argparser.parse_args(args_list, pythonpath='pythonpath')
+    except DataError, err:
+        exit(error=str(err))
+    if opts['help'] or not args:
         exit(msg=__doc__)
     output = opts['output'] is not None and opts['output'] or '.'
     format = opts['format'] is not None and opts['format'] or 'HTML'
@@ -129,7 +128,7 @@
     if msg:
         sys.stdout.write(msg + '\n')
     if error:
-        sys.stderr.write(error + '\n')
+        sys.stderr.write(error + '\n\nTry --help for usage information.\n')
         sys.exit(1)
     sys.exit(0)

Reply via email to