Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GvmConnectionTestCase.test_feed_xml_error fails on macos #550

Open
risicle opened this issue Sep 9, 2021 · 3 comments
Open

GvmConnectionTestCase.test_feed_xml_error fails on macos #550

risicle opened this issue Sep 9, 2021 · 3 comments

Comments

@risicle
Copy link

risicle commented Sep 9, 2021

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

@y0urself
Copy link
Member

y0urself commented Sep 10, 2021

I am developing python-gvm on MacOS and have no problems here. What Hardware are you using, the latest MacBooks?

@y0urself
Copy link
Member

Maybe this helps? eerohele/sublime-lxml#5

@risicle
Copy link
Author

risicle commented Sep 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants