niolabs / python-xbee

Python tools for working with XBee radios
MIT License
101 stars 45 forks source link

Improved Fake Serial device used by unit tests #25

Closed jamesleesaunders closed 7 years ago

jamesleesaunders commented 7 years ago

This PR proposes a number of improvements to the Fake Serial device which is used by the python-xbee unit tests to simulate a serial device.

The reason for these improvements are to support PR #27 which I am which adds support to base.py to attempt to recover from serial failure or unplug. In order for this to work I needed to embellish the Fake.py test device.

jamesleesaunders commented 7 years ago

I was also considering whether it would also be appropriate to rename the file 'Fake.py' to 'fakeSerial.py' (along with all its refs) to make it more obvious what it is. If you think this a good idea I can do this in a subsequent PR.

jamesleesaunders commented 7 years ago

Hi @hansmosh Please consider this PR for inclusion upstream. This PR improves (and simplifies some of the python-xbee tests.

jamesleesaunders commented 7 years ago

Hi @pmalmsten This PR may be of interest to you also?

jamesleesaunders commented 7 years ago

Chris?

hansmosh commented 7 years ago

@jamesleesaunders: My bad, I wasn't getting notifications from GitHub about this. I'll take a look this week.

jamesleesaunders commented 7 years ago

Did you get a chance to review?

jamesleesaunders commented 7 years ago

@hansmosh Thanks for looking at this PR, I am glad you like the merging of the fake serial devices. I have made the requested changes.

The reason for this, was that I did start to replace a couple of the now deprecated pySerial functions with their newer counterparts (https://pythonhosted.org/pyserial/pyserial_api.html?highlight=inwaiting#serial.Serial.inWaiting)...

jamesleesaunders commented 7 years ago

@hansmosh Happy New Year! I have made the requested change, can this be merged in now?