I recently produced a new python module for interacting with heatmiser thermostats using version 3 of their protocol.  I have it setup on github, and have started writing some unit tests to make sure I don't break it, as it's now a dependency of the wonderful https://home-assistant.io.

My main concern is that the module currently only works on python3 due to the datatype differences in the pyserial module.  Essentially in the python2 code, it's possible to pass a string of bytes to the pyserial serial.write() command, but in python3 you need to prepare a bytes datatype to pass to the module.

I want to capture this in my tests, rather than just write an if/else based on the version of python being used.  If you can make any recommendations on how best I achieve this, it would be much appreciated.