niolabs / python-xbee

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

Fix test_is_remote_response_parsed_as_io #54

Closed jamesleesaunders closed 7 years ago

jamesleesaunders commented 7 years ago

Fixes failing test highlighted by @bp1222 #53 (Thanks!) in test_ieee.py failing with:

E       AssertionError: {'fra[80 chars]er': b'\x01\x02\xaa\x00\xaa\x00\xff'} != {'fra[80 chars]er': [{'dio-1': True, 'adc-0': 255, 'dio-3': T[31 chars]ue}]}
E         {'command': b'IS',
E          'frame_id': b'D',
E          'id': 'at_response',
E       -  'parameter': b'\x01\x02\xaa\x00\xaa\x00\xff',
E       +  'parameter': [{'adc-0': 255,
E       +                 'dio-1': True,
E       +                 'dio-3': True,
E       +                 'dio-5': True,
E       +                 'dio-7': True}],
E          'status': b'\x00'}

Interestingly this error is only seen through pytest and not seen through the nosetest suite. I suspect nose does a bit more object clearing in between each test.

The issue was caused by an earlier test temporarily modifying and then deleting the 'parsing' key for packet definition and therefore this later test did not attempt to parse/convert the byte data.

@bp1222 I suggest we get this PR merged in first so you have a clean running set of tests before your PR. @mattdodge @pmalmsten Please can you glance over this PR for merge? There is no functional change to the library, this is simply fixing a broken test.

Thanks!