3 new revisions:

Revision: f0b3894d626b
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 02:17:52 2012
Log: byte string atests: Use different expected values with IronPython than...
http://code.google.com/p/robotframework/source/detail?r=f0b3894d626b

Revision: 3b3593304209
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 03:39:48 2012
Log: Fixed using variables containing non-ASCII byte strings with other tes...
http://code.google.com/p/robotframework/source/detail?r=3b3593304209

Revision: 5755674c2def
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 03:43:57 2012
Log:      Enhanced documentation of Screenshot library....
http://code.google.com/p/robotframework/source/detail?r=5755674c2def

==============================================================================
Revision: f0b3894d626b
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 02:17:52 2012
Log: byte string atests: Use different expected values with IronPython than on other interpreters because it doesn't differentiate byte strings and Unicode strings.
http://code.google.com/p/robotframework/source/detail?r=f0b3894d626b

Modified:
 /atest/robot/core/bytedata.txt
 /atest/testdata/core/bytedata.txt
 /atest/testdata/core/expbytevalues.py

=======================================
--- /atest/robot/core/bytedata.txt      Tue Sep 21 08:16:45 2010
+++ /atest/robot/core/bytedata.txt      Fri Sep 14 02:17:52 2012
@@ -1,33 +1,33 @@
 *** Settings ***
-Documentation In these tests keywords log, raise, and return messages containing ISO-8859-1 byte strings. Notice that they _do not_ use Unicode.
+Documentation   These tests log, raise, and return messages containing byte
+... strings. When these messages are logged, the bytes are escaped. +... Except for IronPython where byte strings and Unicode strings
+...             are the same thing.
 Suite Setup     Run Tests  ${EMPTY}  core/bytedata.txt
 Force Tags      regression  pybot  jybot
 Resource        atest_resource.txt
-Variables       ../../testdata/core/expbytevalues.py
+Variables       ../../testdata/core/expbytevalues.py  ${INTERPRETER}

 *** Test Cases ***
 In Message
-    [Documentation]  In the log message bytes are escaped.
     ${tc}=  Check Test Case  ${TESTNAME}
     Check Log Message  ${tc.kws[0].msgs[0]}  ${exp_log_msg}

 In Return Value
- [Documentation] Return value is not altered by the framework and thus it contains the exact sama bytes that the keyword returned. When the return value is logged, the bytes are escaped. + [Documentation] Return value is not altered by the framework and thus it + ... contains the exact same bytes that the keyword returned.
     ${tc} =  Check Test Case  ${TESTNAME}
     Check Log Message  ${tc.kws[0].msgs[0]}  \${retval} = ${exp_return_msg}

 In Exception
-    [Documentation]  In the error message bytes are escaped.
     ${tc} =  Check Test Case  ${TESTNAME}
     Check Log Message  ${tc.kws[0].msgs[0]}  ${exp_error_msg}  FAIL

 In Exception In Setup
-    [Documentation]  In the error message bytes are escaped.
     ${tc} =  Check Test Case  ${TESTNAME}
     Check Log Message  ${tc.setup.msgs[0]}  ${exp_error_msg}  FAIL

 In Exception In Teardown
-    [Documentation]  In the error message bytes are escaped.
     ${tc} =  Check Test Case  ${TESTNAME}
     Check Log Message  ${tc.teardown.msgs[0]}  ${exp_error_msg}  FAIL

=======================================
--- /atest/testdata/core/bytedata.txt   Tue Sep 21 08:16:45 2010
+++ /atest/testdata/core/bytedata.txt   Fri Sep 14 02:17:52 2012
@@ -1,29 +1,28 @@
 *** Settings ***
-Documentation In these tests keywords log, raise, and return messages containing ISO-8859-1 byte strings. Notice that they _do not_ use Unicode.
 Library         bytelib
 Variables       expbytevalues.py

 *** Test Cases ***
 In Return Value
- [Documentation] Return value is not altered by the framework and thus it contains the exact sama bytes that the keyword returned. When the return value is logged, the bytes are escaped. + [Documentation] Return value is not altered by the framework and thus it + ... contains the exact same bytes that the keyword returned.
     ${retval} =  In Return Value
     Should Be Equal  ${retval}  ${exp_return_value}

 In Message
-    [Documentation]  In the log message bytes are escaped.
     In Message

 In Exception
- [Documentation] In the error message bytes are escaped. FAIL ${exp_error_msg}
+    [Documentation]  FAIL ${exp_error_msg}
     In Exception

 In Exception In Setup
- [Documentation] In the error message bytes are escaped. FAIL Setup failed:\n${exp_error_msg}
+    [Documentation]  FAIL Setup failed:\n${exp_error_msg}
     [Setup]  In Exception
     No Operation

 In Exception In Teardown
- [Documentation] In the error message bytes are escaped. FAIL Teardown failed:\n${exp_error_msg}
+    [Documentation]  FAIL Teardown failed:\n${exp_error_msg}
     No Operation
     [Teardown]  In Exception

=======================================
--- /atest/testdata/core/expbytevalues.py       Tue Mar 30 02:46:22 2010
+++ /atest/testdata/core/expbytevalues.py       Fri Sep 14 02:17:52 2012
@@ -1,4 +1,20 @@
-exp_return_value = 'ty\xf6paikka'
-exp_return_msg = 'ty\\xf6paikka'
-exp_error_msg = 'hyv\\xe4'
-exp_log_msg = '\\xe4ity'
+import sys
+from os.path import basename
+
+
+def get_variables(interpreter=None):
+    if not _running_on_iron_python(interpreter):
+        messages = {'exp_return_msg': 'ty\\xf6paikka',
+                    'exp_error_msg': 'hyv\\xe4',
+                    'exp_log_msg': '\\xe4ity'}
+    else:
+        messages = {'exp_return_msg': 'ty\xf6paikka',
+                    'exp_error_msg': 'hyv\xe4',
+                    'exp_log_msg': '\xe4ity'}
+    return dict(messages, exp_return_value='ty\xf6paikka')
+
+
+def _running_on_iron_python(interpreter):
+    if interpreter:
+        return 'ipy' in basename(interpreter)
+    return sys.platform == 'cli'

==============================================================================
Revision: 3b3593304209
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 03:39:48 2012
Log: Fixed using variables containing non-ASCII byte strings with other test.

Update issue 1231
Status: Done
Fixed.
http://code.google.com/p/robotframework/source/detail?r=3b3593304209

Added:
 /atest/robot/variables/non_string_variables.txt
 /atest/testdata/variables/non_string_variables.py
 /atest/testdata/variables/non_string_variables.txt
Modified:
 /src/robot/variables/variables.py

=======================================
--- /dev/null
+++ /atest/robot/variables/non_string_variables.txt     Fri Sep 14 03:39:48 2012
@@ -0,0 +1,19 @@
+*** Settings ***
+Suite Setup Run Tests ${EMPTY} variables/non_string_variables.txt
+Force Tags       regression    pybot    jybot
+Resource         atest_resource.txt
+Variables ../../testdata/variables/non_string_variables.py ${INTERPRETER}
+
+*** Test Cases ***
+
+Numbers
+    Check Test Doc    ${TESTNAME}    I can has 42 and 3.14?
+
+Byte string
+    Check Test Doc    ${TESTNAME}    We has ${BYTE STRING STR}!
+
+Collections
+    Check Test Doc    ${TESTNAME}    ${LIST STR} ${DICT STR}
+
+Misc
+    Check Test Doc    ${TESTNAME}    True None ${MODULE STR}
=======================================
--- /dev/null
+++ /atest/testdata/variables/non_string_variables.py Fri Sep 14 03:39:48 2012
@@ -0,0 +1,25 @@
+import sys
+from os.path import basename
+
+
+def get_variables(interpreter=None):
+    return {'integer': 42,
+            'float': 3.14,
+            'byte_string': 'hyv\xe4',
+            'byte_string_str': _byte_string_str(interpreter),
+            'boolean': True,
+            'none': None,
+            'module': sys,
+            'module_str': str(sys),
+            'list': [1, '\xe4', u'\xe4'],
+            'list_str': "[1, '\\xe4', u'\\xe4']",
+            'dict': {'\xe4': u'\xe4'},
+            'dict_str': "{'\\xe4': u'\\xe4'}"}
+
+def _byte_string_str(interpreter):
+ return 'hyv\\xe4' if not _running_on_iron_python(interpreter) else 'hyv\xe4'
+
+def _running_on_iron_python(interpreter):
+    if interpreter:
+        return 'ipy' in basename(interpreter)
+    return sys.platform == 'cli'
=======================================
--- /dev/null
+++ /atest/testdata/variables/non_string_variables.txt Fri Sep 14 03:39:48 2012
@@ -0,0 +1,27 @@
+*** Settings ***
+Variables         non_string_variables.py
+Test Template     Should Be Equal
+
+*** Test Cases ***
+Numbers
+    [Documentation]  I can has ${INTEGER} and ${FLOAT}?
+    ${INTEGER}        ${42}
+    -${INTEGER}-      -42-
+    ${FLOAT}          ${3.14}
+    -${FLOAT}-        -3.14-
+
+Byte string
+    [Documentation]  We has ${BYTE STRING}!
+    ${BYTE STRING}    ${BYTE STRING}
+    -${BYTE STRING}-  -${BYTE STRING STR}-
+
+Collections
+    [Documentation]  ${LIST} ${DICT}
+    -${LIST}-         -${LIST STR}-
+    -${DICT}-         -${DICT STR}-
+
+Misc
+    [Documentation]  ${BOOLEAN} ${NONE}  ${MODULE}
+    -${BOOLEAN}-      -True-
+    -${NONE}-         -None-
+    -${MODULE}-       -${MODULE STR}-
=======================================
--- /src/robot/variables/variables.py   Wed Sep 12 05:53:30 2012
+++ /src/robot/variables/variables.py   Fri Sep 14 03:39:48 2012
@@ -184,7 +184,7 @@
                 if not ignore_errors:
                     raise
                 value = string[splitted.start:splitted.end]
-            if not isinstance(value, basestring):
+            if not isinstance(value, unicode):
                 value = utils.unic(value)
             result.append(value)
             string = string[splitted.end:]

==============================================================================
Revision: 5755674c2def
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep 14 03:43:57 2012
Log:      Enhanced documentation of Screenshot library.

Update issue 1225
Documented that taking screenshots requires a display.
http://code.google.com/p/robotframework/source/detail?r=5755674c2def

Modified:
 /src/robot/libraries/Screenshot.py

=======================================
--- /src/robot/libraries/Screenshot.py  Fri Sep 14 01:39:21 2012
+++ /src/robot/libraries/Screenshot.py  Fri Sep 14 03:43:57 2012
@@ -46,11 +46,14 @@


 class Screenshot(object):
- """A test library for taking screenshots and embedding them into log files. + """Test library for taking screenshots on the machine where tests are run.
+
+ Notice that successfully taking screenshots requires tests to be run with
+    a physical or virtual display.

     *Using with Python*

-    On Python you need to have one of the following modules installed to be
+ With Python you need to have one of the following modules installed to be
     able to use this library. The first module that is found will be used.

- wxPython :: http://wxpython.org :: Required also by RIDE so many Robot
@@ -62,15 +65,11 @@

     Python support was added in Robot Framework 2.5.5.

-    *Using with Jython*
+    *Using with Jython and IronPython*

-    On Jython this library uses Java AWT APIs. They are always available
-    and thus no external modules are needed.
-
-    *Using with IronPython*
-
-    On IronPython this library uses .NET APIs. They are always available
-    and thus no external modules are needed.
+ With Jython and IronPython this library uses APIs provided by JVM and .NET
+    platforms, respectively. These APIs are always available and thus no
+    external modules are needed.

     IronPython support was added in Robot Framework 2.7.5.

@@ -180,20 +179,20 @@
         return path

     def take_screenshot(self, name="screenshot", width="800px"):
-        """Takes a screenshot and embeds it into the log file.
+ """Takes a screenshot in JPEG format and embeds it into the log file.

- Name of the file where the screenshot is stored is derived from `name`. - If `name` ends with extension `.jpg` or `.jpeg`, the screenshot will be
-        stored with that name. Otherwise a unique name is created by adding
-        underscore, a running index and extension to the `name`.
+        Name of the file where the screenshot is stored is derived from the
+        given `name`. If the `name` ends with extension `.jpg` or `.jpeg`,
+ the screenshot will be stored with that exact name. Otherwise a unique
+        name is created by adding an underscore, a running index and
+        an extension to the `name`.

         The name will be interpreted to be relative to the directory where
         the log file is written. It is also possible to use absolute paths.
+        Using `/` as a path separator works in all operating systems.

         `width` specifies the size of the screenshot in the log file.

-        The path where the screenshot is saved is returned.
-
         Examples: (LOGDIR is determined automatically by the library)
| Take Screenshot | | | # LOGDIR/screenshot_1.jpg (index automatically incremented) | | Take Screenshot | mypic | | # LOGDIR/mypic_1.jpg (index automatically incremented) |
@@ -202,8 +201,7 @@
| Take Screenshot | images/login.jpg | 80% | # Specify both name and width. | | Take Screenshot | width=550px | | # Specify only width. |

- Screenshots can be only taken in JPEG format. It is possible to use `/`
-        as a path separator in all operating systems.
+        The path where the screenshot is saved is returned.
         """
         path = self._save_screenshot(name)
         self._embed_screenshot(path, width)

Reply via email to