[apycotlib] do not add carriage return between log blocks
authorPaul Tonelli <paul.tonelli@logilab.fr>
Tue, 22 Apr 2014 15:16:34 +0200
changeset 1490 072edbeebb42
parent 1489 286b8e16ffe4
child 1491 3cd58d2dd093
[apycotlib] do not add carriage return between log blocks
_apycotlib/writer.py
test/unittest_apycot.py
--- a/_apycotlib/writer.py	Fri Apr 18 14:22:57 2014 +0200
+++ b/_apycotlib/writer.py	Tue Apr 22 15:16:34 2014 +0200
@@ -149,7 +149,7 @@
     def refresh_log(self):
         log = self._logs
         if self._logs_sent < len(log):
-            files = {'data': ('dummy', u'\n'.join(log[self._logs_sent:]) + '\n' )}
+            files = {'data': ('dummy', u''.join(log[self._logs_sent:]) )}
             if not self._log_file_eid:
                 data = self.cnxh.http_post(self._url, vid='create_subentity',
                                             __cwetype__='File',
--- a/test/unittest_apycot.py	Fri Apr 18 14:22:57 2014 +0200
+++ b/test/unittest_apycot.py	Tue Apr 22 15:16:34 2014 +0200
@@ -52,18 +52,10 @@
     def test_writer_log_content(self):
         checks = self.checks
         self.assertEqual(len(checks), 2)
-        self.assertMultiLineEqual(checks.get_entity(0, 0).log_file[0].data.read(), '''\
-20\t\t\toption=value<br/>
-40\t\t\tbouh<br/>
-50\t\t\tdi&amp;d<br/>
-''')
-        self.assertMultiLineEqual(checks.get_entity(1, 0).log_file[0].data.read(), '''\
-10\t/tmp/something\t12\thip<br/>
-20\t/tmp/something\t\thop<br/>
-30\t\t\tmomo
-
-&lt;br/&gt;<br/>
-''')
+        self.assertEqual(checks.get_entity(0, 0).log_file[0].data.getvalue(),
+                         '20\t\t\toption=value<br/>40\t\t\tbouh<br/>50\t\t\tdi&amp;d<br/>')
+        self.assertEqual(checks.get_entity(1, 0).log_file[0].data.getvalue(),
+                         '10\t/tmp/something\t12\thip<br/>20\t/tmp/something\t\thop<br/>30\t\t\tmomo\n\n&lt;br/&gt;<br/>')
 
     def test_log_formatting_first_check(self):
         stream = []