GvmConnectionTestCase.test_feed_xml_error fails on macos
On macos 10.15, python-gvm 21.6.0, lxml 4.6.3:
__________________ GvmConnectionTestCase.test_feed_xml_error ___________________
self = <tests.connections.test_gvm_connection.GvmConnectionTestCase testMethod=test_feed_xml_error>
def test_feed_xml_error(self):
connection = GvmConnection()
connection._start_xml()
with self.assertRaises(
GvmError, msg='Cannot parse XML response. Response data read bla'
):
> connection._feed_xml("bla")
tests/connections/test_gvm_connection.py:58:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
gvm/connections.py:83: in _feed_xml
self._parser.feed(data)
src/lxml/parser.pxi:1256: in lxml.etree._FeedParser.feed
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
E lxml.etree.ParserError: Unicode parsing is not supported on this platform
src/lxml/parser.pxi:1291: ParserError
I think all that needs to be done here is feed "bla" in as a bytestring instead of a unicode string, because of https://lxml.de/FAQ.html#why-can-t-lxml-parse-my-xml-from-unicode-strings
I am developing python-gvm on MacOS and have no problems here. What Hardware are you using, the latest MacBooks?
Maybe this helps? https://github.com/eerohele/sublime-lxml/issues/5
Yes, that's where I discovered it's not valid to pass a unicode-string to lxml to decode. It's possible this is sensitive to the locale environment variables.
This is python 3.8 and 3.9 on macos 10.15.
Anyway, we can just skip this test if necessary, just thought it would be useful to note that this test does not pass on all systems.