3 new revisions:

Revision: e62e19425c04
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:50:06 2012
Log:      tidy: Fix --inplace with __init__ files
http://code.google.com/p/robotframework/source/detail?r=e62e19425c04

Revision: a62dda334705
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:53:03 2012
Log:      Support for Test Timeout in __init__ files....
http://code.google.com/p/robotframework/source/detail?r=a62dda334705

Revision: 8f993189f7c9
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:53:59 2012
Log:      Tests and doc for Test Timeout in __init__ files....
http://code.google.com/p/robotframework/source/detail?r=8f993189f7c9

==============================================================================
Revision: e62e19425c04
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:50:06 2012
Log:      tidy: Fix --inplace with __init__ files
http://code.google.com/p/robotframework/source/detail?r=e62e19425c04

Modified:
 /src/robot/tidy.py

=======================================
--- /src/robot/tidy.py  Wed Jan 18 04:08:00 2012
+++ /src/robot/tidy.py  Wed Jan 18 20:50:06 2012
@@ -88,12 +88,17 @@

     def inplace(self, path):
         data = self._create_datafile(path)
-        os.remove(data.source)
+        self._remove_original(data)
         data.save(**self._options)

     def _create_data_directory(self, path):
         return TestDataDirectory(source=path).populate()

+    def _remove_original(self, data):
+        initfile = getattr(data, 'initfile', None)
+        source = initfile or data.source
+        os.remove(source)
+
     def _save_recursively(self, data):
         init_file = getattr(data, 'initfile', None)
         if init_file or not hasattr(data, 'initfile'):
@@ -108,6 +113,7 @@
     def _create_datafile(self, source):
         if os.path.splitext(os.path.basename(source))[0] == '__init__':
             data = TestDataDirectory()
+            data.source = os.path.dirname(source)
             data.initfile = source
             FromFilePopulator(data).populate(source)
             return data

==============================================================================
Revision: a62dda334705
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:53:03 2012
Log:      Support for Test Timeout in __init__ files.

Update issue 775
Status: Started
Owner: janne.t.harkonen

Implementation done
http://code.google.com/p/robotframework/source/detail?r=a62dda334705

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

=======================================
--- /src/robot/parsing/model.py Tue Jan 17 00:34:57 2012
+++ /src/robot/parsing/model.py Wed Jan 18 20:53:03 2012
@@ -368,6 +368,7 @@
                 'testprecondition': lambda s: s.test_setup.populate,
                 'testteardown': lambda s: s.test_teardown.populate,
                 'testpostcondition': lambda s: s.test_teardown.populate,
+                'testtimeout': lambda s: s.test_timeout.populate,
                 'forcetags': lambda s: s.force_tags.populate,
                 'library': lambda s: s._get_adder(s.add_library),
                 'resource': lambda s: s._get_adder(s.add_resource),
@@ -376,8 +377,8 @@

     def __iter__(self):
         for setting in [self.doc, self.suite_setup, self.suite_teardown,
- self.test_setup, self.test_teardown, self.force_tags] \
-                        + self.metadata + self.imports:
+ self.test_setup, self.test_teardown, self.force_tags,
+                        self.test_timeout] + self.metadata + self.imports:
             yield setting


=======================================
--- /src/robot/running/defaultvalues.py Fri Jul 22 02:37:58 2011
+++ /src/robot/running/defaultvalues.py Wed Jan 18 20:53:03 2012
@@ -47,9 +47,14 @@
         return self._parent._get_default_teardown()

     def get_timeout(self, tc_timeout):
-        timeout = tc_timeout if tc_timeout.is_set() else self._timeout
+ timeout = tc_timeout if tc_timeout.is_set() else self._get_default_timeout()
         return TestTimeout(timeout.value, timeout.message)

+    def _get_default_timeout(self):
+        if self._timeout.is_set() or not self._parent:
+            return self._timeout
+        return self._parent._get_default_timeout()
+
     def get_tags(self, tc_tags):
         tags = tc_tags if tc_tags.is_set() else self._default_tags
         return (tags + self._get_force_tags()).value

==============================================================================
Revision: 8f993189f7c9
Author:   Janne Härkönen <[email protected]>
Date:     Wed Jan 18 20:53:59 2012
Log:      Tests and doc for Test Timeout in __init__ files.

Update issue 775
Status: Done
http://code.google.com/p/robotframework/source/detail?r=8f993189f7c9

Modified:
 /atest/robot/core/test_suite_init_file.txt
 /atest/testdata/core/test_suite_dir_with_init_file/__init__.txt
/atest/testdata/core/test_suite_dir_with_init_file/sub_suite_with_init_file/__init__.txt
 /doc/userguide/src/CreatingTestData/CreatingTestSuites.txt

=======================================
--- /atest/robot/core/test_suite_init_file.txt  Mon Aug 29 13:02:46 2011
+++ /atest/robot/core/test_suite_init_file.txt  Wed Jan 18 20:53:59 2012
@@ -34,8 +34,8 @@

 Invalid Suite Setting
${base} = Normalize Path ${CURDIR}/../../testdata/core/test_suite_dir_with_init_file - Check Log Message ${ERRORS.msgs[0]} Error in file '${base}${/}__init__.html' in table 'Setting': Non-existing setting 'Invalid'. ERROR - Check Log Message ${ERRORS.msgs[1]} Error in file '${base}${/}sub_suite_with_init_file${/}__init__.html' in table 'Setting': Non-existing setting 'Invalid In Sub'. ERROR + Check Log Message ${ERRORS.msgs[0]} Error in file '${base}${/}__init__.txt' in table 'Setting': Non-existing setting 'Invalid'. ERROR + Check Log Message ${ERRORS.msgs[1]} Error in file '${base}${/}sub_suite_with_init_file${/}__init__.txt' in table 'Setting': Non-existing setting 'Invalid In Sub'. ERROR

 Test Tags
[Documentation] Settings tags for tests using Force and Default Tags in different suite levels and also [Tags] in tests
@@ -73,6 +73,23 @@
Check Test Fixture S2TC2 No Metadata Default setup from suite file Default teardown from suite file Check Test Fixture S2TC2 Fixture Setup defined in test Teardown defined in test

+Test Timeout
+ [Documentation] Setting timeout for tests using Test Timeout in different suite levels and also [Timeout] in tests
+    Check Test Timeout   TC1 No Metadata   1 hour 2 minutes 3 seconds
+    Check Test Timeout   TC1 Timeout   1 second
+    Check Test Timeout   TC2 No Metadata   13 days 6 hours 50 minutes
+    Check Test Timeout   TC2 Timeout   1 hour
+    Check Test Timeout   S1TC1 No Metadata   4 hours 5 minutes 6 seconds
+    Check Test Timeout   S1TC1 Timeout   1 second
+    Check Test Timeout   S1TC2 No Metadata   1 minute 52 seconds
+    Comment   Following step is for issue 152
+    Check Test Timeout   S1TC2 Tags   1 minute 52 seconds
+    Check Test Timeout   S1TC2 Timeout   1 day
+    Check Test Timeout   S2TC1 No Metadata   7 hours 8 minutes 9 seconds
+    Check Test Timeout   S2TC1 Timeout   1 second
+    Check Test Timeout   S2TC2 No Metadata   13 days 6 hours 50 minutes
+    Check Test Timeout   S2TC2 Timeout   1 day
+
 *** Keywords ***
 My Setup
     Run Tests   ${EMPTY}   core/test_suite_dir_with_init_file
=======================================
--- /atest/testdata/core/test_suite_dir_with_init_file/__init__.txt Wed Jan 18 20:35:32 2012 +++ /atest/testdata/core/test_suite_dir_with_init_file/__init__.txt Wed Jan 18 20:53:59 2012
@@ -5,6 +5,7 @@
Test Setup Log Default setup from suite file # Keywords and variables used here should exist in namespace Test Teardown Log Default teardown from suite file # where setup/teardown are used
 Force Tags        suite force
+Test Timeout      13 days 6 hours 50 minutes
 Library           OperatingSystem
 Invalid

=======================================
--- /atest/testdata/core/test_suite_dir_with_init_file/sub_suite_with_init_file/__init__.txt Wed Jan 18 20:35:32 2012 +++ /atest/testdata/core/test_suite_dir_with_init_file/sub_suite_with_init_file/__init__.txt Wed Jan 18 20:53:59 2012
@@ -2,6 +2,7 @@
 Suite Teardown    My Teardown    Teardown of    sub test suite directory
 Test Setup        Log    Default setup from sub suite file
 Force Tags        sub suite force
+Test Timeout      1 minute 52 seconds
 Library           OperatingSystem
 Invalid In Sub

=======================================
--- /doc/userguide/src/CreatingTestData/CreatingTestSuites.txt Thu Dec 2 07:31:20 2010 +++ /doc/userguide/src/CreatingTestData/CreatingTestSuites.txt Wed Jan 18 20:53:59 2012
@@ -5,9 +5,9 @@
 be organized into directories. These files and directories create a
 hierarchical test suite structure.

-.. contents::
+.. contents::
    :depth: 2
-   :local:
+   :local:

 Test case files
 ~~~~~~~~~~~~~~~
@@ -55,8 +55,8 @@
 - Files and directories with names starting with a dot (:path:`.`) or an
   underscore (:path:`_`) are ignored.
 - Directories with the name :path:`CVS` are ignored (case-sensitive).
-- Files not having one of the `recognized extensions`__ (:path:`.html`,
-  :path:`.xhtml`, :path:`.htm`, :path:`.tsv`, :path:`.txt`, :path:`.rst`,
+- Files not having one of the `recognized extensions`__ (:path:`.html`,
+  :path:`.xhtml`, :path:`.htm`, :path:`.tsv`, :path:`.txt`, :path:`.rst`,
   or :path:`.rest`) are ignored (case-insensitive).
 - Other files and directories are processed.

@@ -72,7 +72,7 @@
Normally files that do not have a valid test case table are silently ignored
 with a message written to the syslog_. As of Robot Framework 2.5.5 it is
possible to use a command line option :opt:`--warnonskippedfiles`, which turns
-the message into a warning shown in `test execution errors`__.
+the message into a warning shown in `test execution errors`__.

 __ `Errors and warnings during execution`_

@@ -105,11 +105,13 @@
 `Force Tags`:opt:
Specified tags are unconditionally set to all test cases in all test case files
    this directory contains directly or recursively.
-`Test Setup`:opt:, `Test Teardown`:opt:
-   Set the default value for test setup/teardown to all test cases this
-   directory contains. Can be overridden on lower level.
-`Default Tags`:opt:, `Test Template`:opt:, `Test Timeout`:opt:
-   Not supported in initialization files starting from Robot Framework 2.5.
+`Test Setup`:opt:, `Test Teardown`:opt:, `Test Timeout`:opt:
+ Set the default value for test setup/teardown or test timeout to all test
+   cases this directory contains. Can be overridden on lower level.
+   Support for defining test timeout in initialization files was added in
+   Robot Framework 2.7.
+`Default Tags`:opt:, `Test Template`:opt:
+   Not supported in initialization files.

 .. table:: An example test suite initialization file
    :class: example
@@ -155,9 +157,9 @@
 :path:`My_test_directory` becomes :name:`My test directory`.

 .. note:: The rules for creating test suite names changed slightly in
-         Robot Framework 2.5.
-
-The file or directory name can contain a prefix to control the `execution
+         Robot Framework 2.5.
+
+The file or directory name can contain a prefix to control the `execution
 order`_ of the suites. The prefix is separated from the base name by two
 underscores and, when constructing the actual test suite name, both
 the prefix and underscores are removed. For example files
@@ -170,7 +172,7 @@
 or, with higher-level suites, in test suite initialization files. Test
 suite documentation has exactly the same characteristics regarding to where
 it is shown and how it can be created as `test case
-documentation`_.
+documentation`_.

 .. table:: Test suite documentation example
    :class: example
@@ -179,7 +181,7 @@
Setting Value Value Value ============= ====================== ====================== ====================== Documentation An example test suite documentation with \*some\* _formatting_.
-   ...            See test documentation  for more documentation  examples.
+   ...            See test documentation  for more documentation  examples.
============= ====================== ====================== ======================

 Both the name and documentation of the top-level test suite can be
@@ -201,7 +203,7 @@

 __ `Dividing test data to several rows`_

-.. table:: Metadata examples
+.. table:: Metadata examples
    :class: example

========= =========== ==================== ========================= ==============================
@@ -212,7 +214,7 @@
    Metadata   Executed At  ${HOST}
========= =========== ==================== ========================= ==============================

-For top-level test suites, it is possible to set metadata also with the
+For top-level test suites, it is possible to set metadata also with the
 :opt:`--metadata` command line option. This is discussed in more
 detail in section `Setting metadata`_.

Reply via email to