Opened 8 years ago
Closed 21 months ago
#13066 closed defect (wontfix)
Test failures
Reported by: | Ryan J Ollos | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | XmlRpcPlugin |
Severity: | normal | Keywords: | |
Cc: | Olemis Lang, osimons | Trac Release: |
Description
Running tests on 1.0-stable with OSX results in one failure:
====================================================================== FAIL: test_xml_encoding_special_characters (tracrpc.tests.xml_rpc.RpcXmlTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/rjollos/Documents/Workspace/trac-dev/xmlrpcplugin/tracrpc/tests/xml_rpc.py", line 113, in test_xml_encoding_special_characters ticket[3]['description']) AssertionError: 'Desc & ription\r\nLine 2' != 'Desc & ription\nLine 2' ----------------------------------------------------------------------
With Trac 1.2-stable, two additional failures:
====================================================================== FAIL: test_xml_encoding_special_characters (tracrpc.tests.xml_rpc.RpcXmlTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/rjollos/Documents/Workspace/trac-dev/xmlrpcplugin/tracrpc/tests/xml_rpc.py", line 113, in test_xml_encoding_special_characters ticket[3]['description']) AssertionError: 'Desc & ription\r\nLine 2' != 'Desc & ription\nLine 2' ====================================================================== FAIL: test_getActions (tracrpc.tests.ticket.RpcTicketTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/rjollos/Documents/Workspace/trac-dev/xmlrpcplugin/tracrpc/tests/ticket.py", line 73, in test_getActions self.assertEquals(actions, default) AssertionError: Lists differ: [['leave', 'leave', 'The owner... != [['leave', 'leave', 'The ticke... First differing element 0: ['leave', 'leave', 'The owner will remain <span class="trac-author">< default ></span>.', []] ['leave', 'leave', 'The ticket will remain with no owner.', []] Diff is 1304 characters long. Set self.maxDiff to None to see it. ====================================================================== FAIL: test_update_action (tracrpc.tests.ticket.RpcTicketTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/rjollos/Documents/Workspace/trac-dev/xmlrpcplugin/tracrpc/tests/ticket.py", line 335, in test_update_action self.assertEqual('', current[3].get('owner', '')) AssertionError: '' != '< default >' ----------------------------------------------------------------------
The two failures on 1.2-stable look like changes I'm familiar with from Trac 1.2, so not unexpected.
Attachments (2)
Change History (12)
comment:1 Changed 8 years ago by
Owner: | changed from osimons to Ryan J Ollos |
---|---|
Status: | new → accepted |
Changed 8 years ago by
Attachment: | t13066.diff added |
---|
comment:2 Changed 8 years ago by
Cc: | osimons added |
---|
comment:3 Changed 8 years ago by
For \r\n
vs \n
background see #2482. I noticed it recently but have not researched the cause.
As for proposed changes in attachment I can't remember the details of styling anymore, but as this is just changes to tests I trust that my 0.12.x testing won't break later ;-)
comment:4 Changed 8 years ago by
The response
sent in xmlrpcplugin/trunk/tracrpc/xml_rpc.py@13776:177#L169 contains the \r\n
. I ran tests r13776 and 1.0-stable and the failure is seen. Any ideas where to look next?
comment:5 Changed 8 years ago by
Probably unrelated to the comment:2 issue, but on 1.2-stable the following is output at the end of the test run:
Test failed: <unittest.runner.TextTestResult run=58 errors=0 failures=1> error: Test failed: <unittest.runner.TextTestResult run=58 errors=0 failures=1> /Users/rjollos/Documents/Workspace/trac-dev/teo-rjollos.git/trac/util/__init__.py:413: RuntimeWarning: Parent module 'trac.util' not found while handling absolute import import signal
The RuntimeWarning
isn't seen if I move import signal
to module scope: trac:browser:branches/1.2-stable/trac/util/__init__.py@15609:413#L392.
comment:7 Changed 8 years ago by
Owner: | Ryan J Ollos deleted |
---|---|
Status: | accepted → new |
Remaining issue to be fixed is test failure shown in comment:1.
Changed 4 years ago by
Attachment: | t13066-use-jsonrpc-r18229.diff added |
---|
comment:8 Changed 4 years ago by
The test case creates a ticket with \r\n
confirmed by debug logging.
2021-04-17 12:13:48,308 Trac[xml_rpc] DEBUG: RPC(xml) 'ticket.get' result: [1, datetime.datetime(2021, 4, 17, 3, 13, 48, 292507, tzinfo=<FixedOffset "UTC" 0:00:00>), datetime.datetime(2021, 4, 17, 3, 13, 48, 292507, tzinfo=<FixedOffset "UTC" 0:00:00>), {'status': u'new', 'changetime': datetime.datetime(2021, 4, 17, 3, 13, 48, 292507, tzinfo=<FixedOffset "UTC" 0:00:00>), '_ts': '1618629228292507', 'description': u'Desc & ription\r\nLine 2', 'reporter': u'admin', 'cc': u'', 'resolution': u'', 'time': datetime.datetime(2021, 4, 17, 3, 13, 48, 292507, tzinfo=<FixedOffset "UTC" 0:00:00>), 'component': u'', 'summary': u'One & Two < Four', 'priority': u'major', 'keywords': u'', 'version': u'', 'milestone': u'', 'owner': u'< default >', 'type': u'defect'}]
However, xmlrpclib.loads()
normalizes \r\n
and \n
to \n
.
>>> data = ('aaa\r\nbbb\r\n', 'ccc\nddd\n') >>> xmlrpclib.dumps(data) '<params>\n<param>\n<value><string>aaa\r\nbbb\r\n</string></value>\n</param>\n<param>\n<value><string>ccc\nddd\n</string></value>\n</param>\n</params>\n' >>> xmlrpclib.loads(xmlrpclib.dumps(data)) (('aaa\nbbb\n', 'ccc\nddd\n'), None)
Therefore, ticket.get
via xmlrpc is unable to verify the ticket description has \r\n
. Instead, I think we could use jsonrpc to verify the ticket.
Proposed changes in attachment:t13066-use-jsonrpc-r18229.diff.
comment:9 Changed 21 months ago by
The test_xml_encoding_special_characters
is marked as XFAIL with unittest.expectedFailure
, because newlines are normalized to \n
in xmlrpc.
comment:10 Changed 21 months ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Any idea about this failure? I see it on OSX with Trac 1.0 as well.
Other proposed changes in attachment:t13066.diff. Tests pass for me with Trac 1.0 and 1.2-stable.