2 new revisions:
Revision: de25b59d27f2
Author: Pekka Klärck
Date: Mon Aug 27 06:16:53 2012
Log: Fixed correct unit test that failed with IronPython........
http://code.google.com/p/robotframework/source/detail?r=de25b59d27f2
Revision: d5dbeb31a7e5
Author: Pekka Klärck
Date: Mon Aug 27 07:06:39 2012
Log: ETSource: Verify that source file exists also with IronPython....
http://code.google.com/p/robotframework/source/detail?r=d5dbeb31a7e5
==============================================================================
Revision: de25b59d27f2
Author: Pekka Klärck
Date: Mon Aug 27 06:16:53 2012
Log: Fixed correct unit test that failed with IronPython.....
Update issue 1207
Status: Done
Ooops, "fixed" wrong test. That fix reverted and correct fix applied.
http://code.google.com/p/robotframework/source/detail?r=de25b59d27f2
Modified:
/utest/api/test_run_and_rebot.py
=======================================
--- /utest/api/test_run_and_rebot.py Mon Aug 27 06:09:54 2012
+++ /utest/api/test_run_and_rebot.py Mon Aug 27 06:16:53 2012
@@ -98,10 +98,8 @@
def test_run_fails(self):
assert_equals(run(self.nonex), 252)
assert_equals(run(self.data, outputdir=TEMP), 1)
- # self.nonex always appears in our error message. It may also
appear
- # in the error message by the interpreter included in our message.
self._assert_outputs(stdout=[('Pass And Fail', 2), (LOG, 1)],
- stderr=[('[ ERROR ]', 1), (self.nonex, (1,
2)),
+ stderr=[('[ ERROR ]', 1), (self.nonex, 1),
('--help', 1)])
def test_custom_stdout(self):
@@ -148,8 +146,11 @@
def test_run_fails(self):
assert_equals(rebot(self.nonex), 252)
assert_equals(rebot(self.data, outputdir=TEMP), 1)
+ # self.nonex always appears in our error message. It may also
appear
+ # in the error message by the interpreter included in our message.
self._assert_outputs(stdout=[(LOG, 1)],
- stderr=[('[ ERROR ]', 1), (self.nonex, 1),
('--help', 1)])
+ stderr=[('[ ERROR ]', 1), (self.nonex, (1,
2)),
+ ('--help', 1)])
def test_custom_stdout(self):
stdout = StringIO()
==============================================================================
Revision: d5dbeb31a7e5
Author: Pekka Klärck
Date: Mon Aug 27 07:06:39 2012
Log: ETSource: Verify that source file exists also with IronPython.
Update issue 1207
Status: Done
I noticed that also test related to handling non-existing XML files failed
with IronPython. I fixing the problem by explicitly verifying does the file
exists.
I also realized that the originally reported problem with different error
when using IronPython was caused by not handling non-existing XML files the
same way. I was able to revert the earlier test fix and also that test
still passes.
Now all unit tests pass with IronPython on my WinXP.
http://code.google.com/p/robotframework/source/detail?r=d5dbeb31a7e5
Modified:
/src/robot/utils/etreewrapper.py
/utest/api/test_run_and_rebot.py
=======================================
--- /src/robot/utils/etreewrapper.py Mon Jul 2 08:01:57 2012
+++ /src/robot/utils/etreewrapper.py Mon Aug 27 07:06:39 2012
@@ -13,6 +13,7 @@
# limitations under the License.
import sys
+import os.path
from StringIO import StringIO
@@ -82,6 +83,11 @@
# it didn't close files it had opened. This caused problems with
Jython
# especially on Windows: http://bugs.jython.org/issue1598
# The bug has now been fixed in ET and worked around in Jython
2.5.2.
- # File cannot be opened on IronPython, though, as on IronPython ET
- # doesn't handle non-ASCII characters correctly in that case.
- return open(self._source, 'rb') if not _IRONPYTHON else None
+ if not _IRONPYTHON:
+ return open(self._source, 'rb')
+ # File cannot be opened on IronPython, however, as ET does not
seem to
+ # handle non-ASCII characters correctly in that case. We want to
check
+ # that the file exists even in that case, though.
+ if not os.path.exists(self._source):
+ raise IOError(2, 'No such file', self._source)
+ return None
=======================================
--- /utest/api/test_run_and_rebot.py Mon Aug 27 06:16:53 2012
+++ /utest/api/test_run_and_rebot.py Mon Aug 27 07:06:39 2012
@@ -69,15 +69,9 @@
def _assert_output_contains(self, output, expected):
for content, count in expected:
- if isinstance(count, tuple):
- minimum, maximum = count
- error = '%d-%d' % count
- else:
- minimum = maximum = count
- error = '%d' % count
- if not (minimum <= output.count(content) <= maximum):
- raise AssertionError("'%s' not %s times in output:\n%s"
- % (content, error, output))
+ if output.count(content) != count:
+ raise AssertionError("'%s' not %d times in output:\n%s"
+ % (content, count, output))
class TestRun(Base):
@@ -146,10 +140,8 @@
def test_run_fails(self):
assert_equals(rebot(self.nonex), 252)
assert_equals(rebot(self.data, outputdir=TEMP), 1)
- # self.nonex always appears in our error message. It may also
appear
- # in the error message by the interpreter included in our message.
self._assert_outputs(stdout=[(LOG, 1)],
- stderr=[('[ ERROR ]', 1), (self.nonex, (1,
2)),
+ stderr=[('[ ERROR ]', 1), (self.nonex, 1),
('--help', 1)])
def test_custom_stdout(self):