diff options
author | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-07-17 21:10:06 +0300 |
---|---|---|
committer | Edi Feschiyan <edi.feschiyan@konsulko.com> | 2020-07-17 21:10:06 +0300 |
commit | 8cb620630596701992173c701dfabbf1866c574f (patch) | |
tree | 0b753ceb3c921f91566c6b32b319751a1eacd210 | |
parent | 99536f84fbe06a1beb36b10ee7882ab8efe27141 (diff) |
fix xfail message for bluetooth fixture
fix test_entry_phonebook to xfail instead fail when no records are returned but query is successful
replace 'is not' with !=
-rw-r--r-- | pyagl/services/bluetooth_map.py | 1 | ||||
-rw-r--r-- | pyagl/tests/test_bluetooth.py | 3 | ||||
-rw-r--r-- | pyagl/tests/test_bluetooth_pbap.py | 13 | ||||
-rw-r--r-- | pyagl/tests/test_network.py | 5 |
4 files changed, 15 insertions, 7 deletions
diff --git a/pyagl/services/bluetooth_map.py b/pyagl/services/bluetooth_map.py index c928b43..e434576 100644 --- a/pyagl/services/bluetooth_map.py +++ b/pyagl/services/bluetooth_map.py @@ -29,7 +29,6 @@ class BTMAPService(AGLBaseService): async def unsubscribe(self, event='notification'): return await super().subscribe(event) - async def main(loop): args = BTMAPService.parser.parse_args() bmp = await BTMAPService(args.ipaddr) diff --git a/pyagl/tests/test_bluetooth.py b/pyagl/tests/test_bluetooth.py index 167ff7f..14da24b 100644 --- a/pyagl/tests/test_bluetooth.py +++ b/pyagl/tests/test_bluetooth.py @@ -32,7 +32,8 @@ async def service(): def btaddr(): bthtestaddr = os.environ.get('AGL_BT_TEST_ADDR', None) if not bthtestaddr: - pytest.xfail('No test bluetooth test address set in environment variables') + pytest.xfail('No test bluetooth test address set in environment variables; please export AGL_BT_TEST_ADDR in ' + 'DBus address style as AGL_BT_TEST_ADDR=dev_A1_02_B3_04_C5_00') return bthtestaddr diff --git a/pyagl/tests/test_bluetooth_pbap.py b/pyagl/tests/test_bluetooth_pbap.py index 7084f28..c8e35b0 100644 --- a/pyagl/tests/test_bluetooth_pbap.py +++ b/pyagl/tests/test_bluetooth_pbap.py @@ -125,12 +125,19 @@ async def test_history_combined_calls(event_loop, service: PBAP): @pytest.mark.dependency(depends=['test_contacts']) +async def test_entry_phonebook_verb(event_loop, service: PBAP, searchvcf): + msgid = await service.entry(handle=searchvcf) + resp = await service.afbresponse() + assert resp.status == 'success', resp.info + + +@pytest.mark.dependency(depends=['test_entry_phonebook_verb']) async def test_entry_phonebook(event_loop, service: PBAP, searchvcf): msgid = await service.entry(handle=searchvcf) resp = await service.afbresponse() - assert resp.status == 'success' - assert 'vcards' in resp.data - assert len(resp.data['vcards']) > 0 + assert 'vcards' in resp.data, 'Verb call succeeded but did contain "vcards" key' + if resp.data['vcards'] is None: + pytest.xfail('The response did not contain "vcards" entries') @pytest.mark.dependency(depends=['test_contacts']) diff --git a/pyagl/tests/test_network.py b/pyagl/tests/test_network.py index 6c7c12d..e69000b 100644 --- a/pyagl/tests/test_network.py +++ b/pyagl/tests/test_network.py @@ -33,7 +33,8 @@ async def test_state(event_loop, service: NS): async def test_global_offline(event_loop, service: NS): addr, _ = service.websocket.remote_address - if addr is not 'localhost' or addr is not '127.0.0.1': + print(f"Remote address is {addr}") + if addr != 'localhost' or addr != '127.0.0.1': pytest.skip('We want to skip global offline mode until this is ran locally on the board against localhost') msgid = await service.offline(True) resp = await service.afbresponse() @@ -222,7 +223,7 @@ async def test_enable_ethernet(event_loop, service: NS, expected_available_techs async def test_disable_ethernet(event_loop, service: NS, expected_available_techs): addr, _ = service.websocket.remote_address - if addr is not 'localhost' or addr is not '127.0.0.1': + if addr != 'localhost' or addr != '127.0.0.1': pytest.skip('Skipping this test until it is ran locally on the board, ' 'presuming it is the only available interface to connect to remotely for testing') if 'ethernet' not in expected_available_techs: |