3 new revisions:
Revision: e6d5ca35a8d9
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:05:41 2014 UTC
Log: test cleanup, including not using same name twice
http://code.google.com/p/robotframework/source/detail?r=e6d5ca35a8d9
Revision: d84704510c53
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:10:43 2014 UTC
Log: utests: disable tests that fail on ironpython
http://code.google.com/p/robotframework/source/detail?r=d84704510c53
Revision: 7636983338e7
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:46:30 2014 UTC
Log: Fixed decoding output of Run keyword with IronPython....
http://code.google.com/p/robotframework/source/detail?r=7636983338e7
==============================================================================
Revision: e6d5ca35a8d9
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:05:41 2014 UTC
Log: test cleanup, including not using same name twice
http://code.google.com/p/robotframework/source/detail?r=e6d5ca35a8d9
Modified:
/utest/model/test_tags.py
=======================================
--- /utest/model/test_tags.py Fri Jan 24 00:22:03 2014 UTC
+++ /utest/model/test_tags.py Fri Jan 24 09:05:41 2014 UTC
@@ -114,7 +114,7 @@
assert_equal(list(tags2), ['ee', 'XX', 'zz'])
assert_equal(list(new_tags), ['ee', 'xx', 'yy', 'zz'])
- def test__add__list(self):
+ def test__add__None(self):
tags = Tags(['xx', 'yy'])
new_tags = tags + None
assert_true(isinstance(new_tags, Tags))
@@ -163,9 +163,10 @@
self._verify(inp, [inp[0]])
def test_sorting(self):
- for inp, exp in [(['SORT','1','B','2','a'],
['1','2','a','B','SORT']),
- (['all', 'A L
L', 'NONE', '10', '1', 'A', 'a', ''],
- ['1', '10', 'A', 'all'])]:
+ for inp, exp in [(['SORT', '1', 'B', '2', 'a'],
+ ['1', '2', 'a', 'B', 'SORT']),
+ (['all', 'A
LL', 'NONE', '10', '1', 'A', 'a', '', 'b'],
+ ['1', '10', 'A', 'all', 'b'])]:
self._verify(inp, exp)
def _verify(self, tags, expected):
==============================================================================
Revision: d84704510c53
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:10:43 2014 UTC
Log: utests: disable tests that fail on ironpython
http://code.google.com/p/robotframework/source/detail?r=d84704510c53
Modified:
/utest/model/test_tags.py
/utest/utils/test_unic.py
=======================================
--- /utest/model/test_tags.py Fri Jan 24 09:05:41 2014 UTC
+++ /utest/model/test_tags.py Fri Jan 24 09:10:43 2014 UTC
@@ -1,4 +1,5 @@
import unittest
+import sys
from robot.utils.asserts import assert_equal, assert_true, assert_false
from robot import utils
@@ -218,9 +219,12 @@
assert_true(patterns.match(['x', 'y']))
assert_true(patterns.match(['x', 'Y', 'z']))
- def test_ands_and_ors(self):
- for pattern in AndOrPatternGenerator(max_length=5):
- assert_equal(TagPattern(pattern).match('1'),
eval(pattern.lower()))
+ if sys.platform != 'cli': # eval below sometimes fails on IronPython
+
+ def test_ands_and_ors(self):
+ for pattern in AndOrPatternGenerator(max_length=5):
+ expected = eval(pattern.lower())
+ assert_equal(TagPattern(pattern).match('1'), expected)
def test_not(self):
patterns = TagPatterns(['xNOTy', '???NOT?'])
=======================================
--- /utest/utils/test_unic.py Thu Jan 23 15:01:51 2014 UTC
+++ /utest/utils/test_unic.py Fri Jan 24 09:10:43 2014 UTC
@@ -53,10 +53,11 @@
# This is to check that unic normalizes all strings to NFC
assert_equals(unic(unicodedata.normalize('NFD', text)), text)
- def test_encoding(self):
- good = u'hyv\xe4'
- assert_equals(unic(good.encode('UTF-8'), 'UTF-8'), good)
- assert_equals(unic(good.encode('UTF-8'), 'ASCII', 'ignore'), 'hyv')
+ if not IPY:
+ def test_encoding(self):
+ good = u'hyv\xe4'
+ assert_equals(unic(good.encode('UTF-8'), 'UTF-8'), good)
+
assert_equals(unic(good.encode('UTF-8'), 'ASCII', 'ignore'), 'hyv')
def test_encoding_when_already_unicode(self):
good = u'hyv\xe4'
==============================================================================
Revision: 7636983338e7
Branch: default
Author: Pekka Klärck
Date: Fri Jan 24 09:46:30 2014 UTC
Log: Fixed decoding output of Run keyword with IronPython.
Because IronPython doesn't differentiate unicode and str types, needed to
revert the earlier change to unic() to return Unicode strings as-is.
Instead decode_output() now returns Unicode immediately, unless new force
agument used explicitly.
http://code.google.com/p/robotframework/source/detail?r=7636983338e7
Added:
/utest/utils/test_encoding.py
Modified:
/src/robot/libraries/OperatingSystem.py
/src/robot/utils/encoding.py
/src/robot/utils/unic.py
/utest/utils/test_unic.py
=======================================
--- /dev/null
+++ /utest/utils/test_encoding.py Fri Jan 24 09:46:30 2014 UTC
@@ -0,0 +1,33 @@
+import unittest
+import sys
+
+from robot.utils.asserts import assert_equals
+from robot.utils.encoding import decode_output, OUTPUT_ENCODING
+
+
+UNICODE = u'hyv\xe4'
+ENCODED = UNICODE.encode(OUTPUT_ENCODING)
+IRONPYTHON = sys.platform == 'cli'
+
+
+class TestDecodeOutput(unittest.TestCase):
+
+ def test_return_unicode_as_is_by_default(self):
+ assert isinstance(UNICODE, unicode)
+ assert_equals(decode_output(UNICODE), UNICODE)
+
+ if not IRONPYTHON:
+
+ def test_decode(self):
+ assert isinstance(ENCODED, str)
+ assert_equals(decode_output(ENCODED), UNICODE)
+
+ else:
+
+ def test_force_decoding(self):
+ assert isinstance(ENCODED, unicode)
+ assert_equals(decode_output(ENCODED, force=True), UNICODE)
+
+
+if __name__ == '__main__':
+ unittest.main()
=======================================
--- /src/robot/libraries/OperatingSystem.py Thu Jan 23 14:00:53 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py Fri Jan 24 09:46:30 2014 UTC
@@ -1343,7 +1343,7 @@
stdout = stdout.replace('\r\n', '\n') #
http://bugs.jython.org/issue1566
if stdout.endswith('\n'):
stdout = stdout[:-1]
- return decode_output(stdout)
+ return decode_output(stdout, force=True)
class _Process2(_Process):
=======================================
--- /src/robot/utils/encoding.py Thu Jan 23 14:00:53 2014 UTC
+++ /src/robot/utils/encoding.py Fri Jan 24 09:46:30 2014 UTC
@@ -22,8 +22,15 @@
SYSTEM_ENCODING = get_system_encoding()
-def decode_output(string):
- """Decodes bytes from console encoding to Unicode."""
+def decode_output(string, force=False):
+ """Decodes bytes from console encoding to Unicode.
+
+ By default returns Unicode strings as-is. `force` argument can be used
+ on IronPython where all strings are `unicode` and caller knows decoding
+ is needed.
+ """
+ if isinstance(string, unicode) and not force:
+ return string
return unic(string, OUTPUT_ENCODING)
=======================================
--- /src/robot/utils/unic.py Thu Jan 23 15:01:51 2014 UTC
+++ /src/robot/utils/unic.py Fri Jan 24 09:46:30 2014 UTC
@@ -50,8 +50,6 @@
def _unic(item, *args):
# Based on a recipe from http://code.activestate.com/recipes/466341
try:
- if isinstance(item, unicode):
- return item
return unicode(item, *args)
except UnicodeError:
try:
=======================================
--- /utest/utils/test_unic.py Fri Jan 24 09:10:43 2014 UTC
+++ /utest/utils/test_unic.py Fri Jan 24 09:46:30 2014 UTC
@@ -59,11 +59,6 @@
assert_equals(unic(good.encode('UTF-8'), 'UTF-8'), good)
assert_equals(unic(good.encode('UTF-8'), 'ASCII', 'ignore'), 'hyv')
- def test_encoding_when_already_unicode(self):
- good = u'hyv\xe4'
- assert_equals(unic(good, 'UTF-8'), good)
- assert_equals(unic(good, 'UTF-8', 'ignore'), good)
-
def test_object_containing_unicode_repr(self):
assert_equals(unic(UnicodeRepr()), u'Hyv\xe4')
--
---
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 robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.