cocagne / txdbus

Native Python implementation of DBus for Twisted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Roundtrip tests between different Py versions

oberstet opened this issue · comments

Split out from #11

I only have sketchy knowledge about dbus and stuff, haven't looked deeply enough into the txdbus codebase, but are the unit tests actually talk to a real dbus? and if so, are there tests that

  • roundtrip Py2 -> dbus -> Py2 (and Py3 -> dbus -> Py3) - eg both a proc implemented in Py and called from Py
  • roundtrip Py2 -> dbus -> Py3 (and Py3 -> dbus -> Py2)

What I meant with round-tripping is between different Python versions.

Like have a procedure implemented in Python 3, exposed via Dbus, and being called from Python 2.

Where the procedure name is a fancy Unicode name, and/or the procedure takes an Unicode argument (and the test actually uses non-US-ASCII characters) and/or the procedure takes a binary argument (and the test actually uses a binary value which isn't valid UTF8).

Regarding round-tripping tests on same Python version, is the following a glitch? A bytes value of length 0 (b'') behaves differently on the two:

Testing across different Python version is more complicated, I agree. One way that should work would be creating two virtualenv inside the Travis CI container with two different Python versions, and then drive the test from either side, effectively testing Python 2 unit tests versus Python 3 txdbus and vice versa. If we could do that, and have a single code base for both the library and the unit tests, then I think that would clearly demonstrate full support for both Python versions.

commented

I agree that there's a bug here (which is kinda obvious since our behaviour/results vary across python versions).

However, I'm not sure that sending 'Hello-µ@ßöäüàá-UTF-8!!' should fail. The spec says that Unicode-escaping is valid, so that should not fail if we send that text Unicode-escaped (which I'd have to check the source to see if we're doing or not). Based on that, we can assert if the python2 version is misbehaving or the python3 version is.