aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyagl/services/can.py37
-rw-r--r--pyagl/tests/test_audiomixer.py3
-rw-r--r--pyagl/tests/test_bluetooth.py21
-rw-r--r--pyagl/tests/test_bluetooth_map.py10
-rw-r--r--pyagl/tests/test_bluetooth_pbap.py29
-rw-r--r--pyagl/tests/test_can.py52
-rw-r--r--pyagl/tests/test_geoclue.py5
-rw-r--r--pyagl/tests/test_gps.py14
-rw-r--r--pyagl/tests/test_mediascanner.py5
-rw-r--r--pyagl/tests/test_network.py32
-rw-r--r--pyagl/tests/test_nfc.py4
-rw-r--r--pyagl/tests/test_weather.py14
12 files changed, 116 insertions, 110 deletions
diff --git a/pyagl/services/can.py b/pyagl/services/can.py
index 2fb1768..e22b840 100644
--- a/pyagl/services/can.py
+++ b/pyagl/services/can.py
@@ -15,21 +15,54 @@
from pyagl.services.base import AGLBaseService, AFBResponse
import asyncio
+import json
import os
class CANService(AGLBaseService):
service = 'service-can-low'
parser = AGLBaseService.getparser()
+ parser.add_argument('--auth', help='Send an authentication request', action='store_true')
+ parser.add_argument('--write', metavar='JSON', help='Write values to CAN')
+ parser.add_argument('--list', help='List CAN signals', action='store_true')
- def __init__(self, ip, port=None, service='service-can-low'):
- super().__init__(api='signal-composer', ip=ip, port=port, service=service)
+ def __init__(self, ip, port=None, service='service-can-low-level'):
+ super().__init__(api='low-can', ip=ip, port=port, service=service)
# more init stuff specific to the new service
+ async def auth(self):
+ return await self.request('auth')
+
+ async def write(self, values: dict, msgid=None):
+ return await self.request('write', values, msgid=msgid)
+
+ async def get(self, event):
+ return await self.request('get', {'event': event})
+
+ async def list(self):
+ return await self.request('list')
+
async def main(loop):
args = CANService.parser.parse_args()
svc = await CANService(args.ipaddr)
+ sessionid = 0
+ if args.auth:
+ sessionid = await svc.auth()
+ data = await svc.afbresponse()
+ print(data)
+
+ if args.list:
+ msgid = await svc.list()
+ data = await svc.afbresponse()
+ print(data)
+
+ if args.write:
+ values = json.loads(args.write)
+ msgid = await svc.write(values, msgid=sessionid)
+ data = await svc.afbresponse()
+ print(data)
+
if __name__ == '__main__':
loop = asyncio.get_event_loop()
diff --git a/pyagl/tests/test_audiomixer.py b/pyagl/tests/test_audiomixer.py
index 17cf9eb..ce13530 100644
--- a/pyagl/tests/test_audiomixer.py
+++ b/pyagl/tests/test_audiomixer.py
@@ -21,7 +21,7 @@ from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.audiomixer import AudioMixerService as AMS
import logging
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.audiomixer]
@pytest.fixture(scope='module')
@@ -41,7 +41,6 @@ async def service():
@pytest.mark.regular
-@pytest.mark.audiomixer
async def test_list_controls(event_loop, service: AMS):
msgid = await service.list_controls()
resp = await service.afbresponse()
diff --git a/pyagl/tests/test_bluetooth.py b/pyagl/tests/test_bluetooth.py
index 10079bd..1af2dda 100644
--- a/pyagl/tests/test_bluetooth.py
+++ b/pyagl/tests/test_bluetooth.py
@@ -23,7 +23,7 @@ import logging
logger = logging.getLogger(f'pytest-{BTS.service}')
logger.setLevel(logging.DEBUG)
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.bluetooth]
@pytest.fixture(scope='module')
@@ -43,7 +43,6 @@ async def service():
@pytest.mark.xfail
-@pytest.mark.bluetooth
@pytest.fixture(scope='module')
def btaddr():
bthtestaddr = os.environ.get('AGL_BT_TEST_ADDR', None)
@@ -55,7 +54,6 @@ def btaddr():
@pytest.mark.regular
-@pytest.mark.bluetooth
@pytest.mark.dependency
async def test_default_adapter(event_loop, service: BTS):
msgid = await service.default_adapter('hci0')
@@ -66,7 +64,6 @@ async def test_default_adapter(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_subscribe_device_changes(event_loop, service: BTS):
msgid = await service.subscribe('device_changes')
resp = await service.afbresponse()
@@ -74,7 +71,6 @@ async def test_subscribe_device_changes(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_unsubscribe_device_changes(event_loop, service: BTS):
msgid = await service.unsubscribe('device_changes')
resp = await service.afbresponse()
@@ -82,7 +78,6 @@ async def test_unsubscribe_device_changes(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_subscribe_adapter_changes(event_loop, service: BTS):
msgid = await service.subscribe('adapter_changes')
resp = await service.afbresponse()
@@ -90,7 +85,6 @@ async def test_subscribe_adapter_changes(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_unsubscribe_adapter_changes(event_loop, service: BTS):
msgid = await service.unsubscribe('adapter_changes')
resp = await service.afbresponse()
@@ -98,7 +92,6 @@ async def test_unsubscribe_adapter_changes(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_subscribe_media(event_loop, service: BTS):
msgid = await service.subscribe('media')
resp = await service.afbresponse()
@@ -106,7 +99,6 @@ async def test_subscribe_media(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_unsubscribe_media(event_loop, service: BTS):
msgid = await service.unsubscribe('media')
resp = await service.afbresponse()
@@ -114,7 +106,6 @@ async def test_unsubscribe_media(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_subscribe_agent(event_loop, service: BTS):
msgid = await service.subscribe('agent')
resp = await service.afbresponse()
@@ -122,14 +113,12 @@ async def test_subscribe_agent(event_loop, service: BTS):
@pytest.mark.regular
-@pytest.mark.bluetooth
async def test_unsubscribe_agent(event_loop, service: BTS):
msgid = await service.unsubscribe('agent')
resp = await service.afbresponse()
assert resp.status == 'success', resp.info
@pytest.mark.regular
-@pytest.mark.bluetooth
@pytest.mark.dependency(depends=['test_default_adapter'])
async def test_managed_objects(event_loop, service: BTS):
msgid = await service.managed_objects()
@@ -137,7 +126,6 @@ async def test_managed_objects(event_loop, service: BTS):
assert resp.status == 'success', resp.info
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
async def test_has_single_adapter(event_loop, service: BTS):
msgid = await service.managed_objects()
resp = await service.afbresponse()
@@ -146,7 +134,6 @@ async def test_has_single_adapter(event_loop, service: BTS):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
@pytest.mark.dependency(depends=['test_default_adapter'])
async def test_adapter_state(event_loop, service: BTS):
msgid = await service.adapter_state('hci0')
@@ -155,7 +142,6 @@ async def test_adapter_state(event_loop, service: BTS):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
async def test_pairing_verb(event_loop, service: BTS, btaddr):
msgid = await service.pair(btaddr)
resp = await service.afbresponse()
@@ -164,7 +150,6 @@ async def test_pairing_verb(event_loop, service: BTS, btaddr):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
@pytest.mark.dependency
async def test_connect_verb(event_loop, service: BTS, btaddr):
msgid = await service.connect(btaddr)
@@ -174,7 +159,6 @@ async def test_connect_verb(event_loop, service: BTS, btaddr):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
@pytest.mark.xfail(reason='This is expected to fail because there has to be an ongoing pairing attempt')
async def test_confirm_pairing_verb(event_loop, service: BTS, btaddr):
msgid = await service.confirm_pairing(pincode='123456')
@@ -184,7 +168,6 @@ async def test_confirm_pairing_verb(event_loop, service: BTS, btaddr):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
@pytest.mark.dependency(depends=['test_connect_verb'])
async def test_avrcp_controls(event_loop, service: BTS):
avrcp_actions = ['Play', 'Pause', 'Stop', 'Next', 'Previous']
@@ -196,7 +179,6 @@ async def test_avrcp_controls(event_loop, service: BTS):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
async def test_disconnect_verb(event_loop, service: BTS, btaddr):
msgid = await service.disconnect(btaddr)
resp = await service.afbresponse()
@@ -205,7 +187,6 @@ async def test_disconnect_verb(event_loop, service: BTS, btaddr):
@pytest.mark.hwrequired
-@pytest.mark.bluetooth
async def test_remove_pairing_verb(event_loop, service: BTS, btaddr):
msgid = await service.remove_device(btaddr)
resp = await service.afbresponse()
diff --git a/pyagl/tests/test_bluetooth_map.py b/pyagl/tests/test_bluetooth_map.py
index 58062fd..fee0916 100644
--- a/pyagl/tests/test_bluetooth_map.py
+++ b/pyagl/tests/test_bluetooth_map.py
@@ -21,7 +21,7 @@ from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.bluetooth_map import BTMAPService as BMP
import logging
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.btmap]
@pytest.fixture(scope='module')
@@ -56,7 +56,6 @@ def composetext():
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.xfail(reason='Expected to fail if no messages are found')
@pytest.fixture(scope='module')
async def messages(service: BMP):
@@ -68,7 +67,6 @@ async def messages(service: BMP):
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.dependency
async def test_list_messages(event_loop, service: BMP):
msgid = await service.list_messages()
@@ -77,7 +75,6 @@ async def test_list_messages(event_loop, service: BMP):
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.dependency(depends=['test_list_messages'])
@pytest.mark.xfail(reason='Expected to fail if there are no messages, need message id to test the verb')
async def test_message_verb(event_loop, service, messages):
@@ -87,8 +84,8 @@ async def test_message_verb(event_loop, service, messages):
resp = await service.afbresponse()
assert resp.status == 'success'
+
@pytest.mark.regular
-@pytest.mark.btmap
@pytest.mark.dependency
async def test_subscribe_notifications(event_loop, service: BMP):
msgid = await service.subscribe('notification')
@@ -98,7 +95,6 @@ async def test_subscribe_notifications(event_loop, service: BMP):
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.dependency
async def test_compose_message(event_loop, service: BMP, recipient, composetext):
msgid = await service.compose(recipient, composetext)
@@ -107,7 +103,6 @@ async def test_compose_message(event_loop, service: BMP, recipient, composetext)
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.dependency(depends=['test_compose_message', 'test_subscribe_notifications'])
async def test_message_to_self(event_loop, service: BMP, recipient, composetext):
resp = await service.afbresponse()
@@ -119,7 +114,6 @@ async def test_message_to_self(event_loop, service: BMP, recipient, composetext)
@pytest.mark.hwrequired
-@pytest.mark.btmap
@pytest.mark.dependency(depends=['test_subscribe_notifications'])
async def test_unsubscribe_notifications(event_loop, service: BMP):
msgid = await service.unsubscribe('notification')
diff --git a/pyagl/tests/test_bluetooth_pbap.py b/pyagl/tests/test_bluetooth_pbap.py
index 25b8ba4..b70c914 100644
--- a/pyagl/tests/test_bluetooth_pbap.py
+++ b/pyagl/tests/test_bluetooth_pbap.py
@@ -21,7 +21,7 @@ import logging
from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.bluetooth_pbap import BTPBAPService as PBAP
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.btpbap]
@pytest.fixture(scope='module')
@@ -58,7 +58,6 @@ def searchvcf():
@pytest.mark.regular
-@pytest.mark.btpbap
@pytest.mark.dependency
async def test_status(event_loop, service: PBAP):
msgid = await service.status()
@@ -70,14 +69,14 @@ async def test_status(event_loop, service: PBAP):
pytest.xfail('BT PBAP is not currently connected to the phone')
assert resp.data['connected'] is True
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
async def test_search(event_loop, service: PBAP, phonenumber):
msgid = await service.search(phonenumber)
resp = await service.afbresponse()
assert resp.status == 'success'
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_status'])
async def test_import_contacts(event_loop, service: PBAP):
@@ -90,7 +89,7 @@ async def test_import_contacts(event_loop, service: PBAP):
assert len(vcards) > 0
print(f' import verb from OBEX returned {len(vcards)} .vcf objects ')
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_import_contacts'])
async def test_contacts(event_loop, service: PBAP):
@@ -103,7 +102,7 @@ async def test_contacts(event_loop, service: PBAP):
assert len(vcards) > 0
print(f' contacts verb returned {len(vcards)} cached .vcf objects ')
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_history_incoming_calls(event_loop, service: PBAP):
@@ -114,7 +113,7 @@ async def test_history_incoming_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_history_outgoing_calls(event_loop, service: PBAP):
@@ -125,7 +124,7 @@ async def test_history_outgoing_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_history_missed_calls(event_loop, service: PBAP):
@@ -136,7 +135,7 @@ async def test_history_missed_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_history_combined_calls(event_loop, service: PBAP):
@@ -147,7 +146,7 @@ async def test_history_combined_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_entry_phonebook_verb(event_loop, service: PBAP, searchvcf):
@@ -155,7 +154,7 @@ async def test_entry_phonebook_verb(event_loop, service: PBAP, searchvcf):
resp = await service.afbresponse()
assert resp.status == 'success', resp.info
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_entry_phonebook_verb'])
async def test_entry_phonebook(event_loop, service: PBAP, searchvcf):
@@ -165,7 +164,7 @@ async def test_entry_phonebook(event_loop, service: PBAP, searchvcf):
if resp.data['vcards'] is None:
pytest.xfail('The response did not contain "vcards" entries')
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_incoming_calls(event_loop, service: PBAP):
@@ -176,7 +175,7 @@ async def test_incoming_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_outgoing_calls(event_loop, service: PBAP):
@@ -187,7 +186,7 @@ async def test_outgoing_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_missed_calls(event_loop, service: PBAP):
@@ -198,7 +197,7 @@ async def test_missed_calls(event_loop, service: PBAP):
vcards = resp.data['vcards']
assert len(vcards) > 0
-@pytest.mark.btpbap
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_contacts'])
async def test_combined_calls(event_loop, service: PBAP):
diff --git a/pyagl/tests/test_can.py b/pyagl/tests/test_can.py
new file mode 100644
index 0000000..1283939
--- /dev/null
+++ b/pyagl/tests/test_can.py
@@ -0,0 +1,52 @@
+import asyncio
+import os
+import pytest
+import logging
+from pyagl.services.base import AFBResponse, AFBT
+
+from pyagl.services.can import CANService as cs
+pytestmark = [pytest.mark.asyncio, pytest.mark.can]
+
+
+@pytest.fixture(scope='module')
+def event_loop():
+ loop = asyncio.get_event_loop()
+ yield loop
+
+
+@pytest.fixture(scope='module')
+async def service():
+ address = os.environ.get('AGL_TGT_IP', 'localhost')
+ port = os.environ.get('AGL_TGT_PORT', None)
+ svc = await cs(ip=address, port=port)
+ yield svc
+ await svc.websocket.close()
+
+
+@pytest.mark.regular
+async def test_list(event_loop, service: cs):
+ msgid = await service.list()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+
+@pytest.mark.regular
+async def test_get(event_loop, service: cs):
+ msgid = await service.get("engine.speed")
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+
+@pytest.mark.regular
+async def test_auth(event_loop, service: cs):
+ msgid = await service.auth()
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
+
+@pytest.mark.regular
+async def test_write(event_loop, service: cs):
+ msgid = await service.write({"signal_name": "hvac.temperature.left", "signal_value": 21})
+ resp = await service.afbresponse()
+ assert resp.status == 'success'
+
diff --git a/pyagl/tests/test_geoclue.py b/pyagl/tests/test_geoclue.py
index 30a0ce3..6bc6cad 100644
--- a/pyagl/tests/test_geoclue.py
+++ b/pyagl/tests/test_geoclue.py
@@ -20,7 +20,7 @@ import logging
from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.geoclue import GeoClueService as gcs
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.geoclue]
@pytest.fixture(scope='module')
@@ -39,7 +39,6 @@ async def service():
@pytest.mark.regular
-@pytest.mark.geoclue
async def test_location(event_loop, service: gcs):
msgid = await service.location()
resp = await service.afbresponse()
@@ -49,7 +48,6 @@ async def test_location(event_loop, service: gcs):
@pytest.mark.regular
-@pytest.mark.geoclue
async def test_subscribe(event_loop, service: gcs):
msgid = await service.subscribe()
resp = await service.afbresponse()
@@ -60,7 +58,6 @@ async def test_subscribe(event_loop, service: gcs):
@pytest.mark.regular
-@pytest.mark.geoclue
async def test_unsubscribe(event_loop, service: gcs):
msgid = await service.unsubscribe()
resp = await service.afbresponse()
diff --git a/pyagl/tests/test_gps.py b/pyagl/tests/test_gps.py
index 3f9a4db..3f47684 100644
--- a/pyagl/tests/test_gps.py
+++ b/pyagl/tests/test_gps.py
@@ -21,7 +21,7 @@ from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.gps import GPSService as GPS
from asyncio.exceptions import TimeoutError
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.gps]
@pytest.fixture(scope='module')
@@ -43,14 +43,14 @@ async def service():
# async for _response in service.listener():
# yield _response
-@pytest.mark.gps
+
@pytest.mark.regular
async def test_location_verb(event_loop, service: GPS):
msgid = await service.location()
resp = await service.afbresponse()
assert resp.msgid == msgid
-@pytest.mark.gps
+
@pytest.mark.regular
@pytest.mark.xfail(reason='expecting this to fail because of "No 3D GNSS fix" and GPS is unavailable')
async def test_location_result(event_loop, service: GPS):
@@ -59,7 +59,6 @@ async def test_location_result(event_loop, service: GPS):
assert resp.status == 'success'
-@pytest.mark.gps
@pytest.mark.regular
async def test_subscribe_verb(event_loop, service: GPS):
msgid = await service.subscribe()
@@ -68,7 +67,6 @@ async def test_subscribe_verb(event_loop, service: GPS):
assert resp.status == 'success'
-@pytest.mark.gps
@pytest.mark.regular
@pytest.mark.dependency
async def test_enable_recording(event_loop, service: GPS):
@@ -77,7 +75,6 @@ async def test_enable_recording(event_loop, service: GPS):
assert resp.status == 'success', resp.info
-@pytest.mark.gps
@pytest.mark.regular
@pytest.mark.dependency(depends=['test_enable_recording'])
async def test_disable_recording(event_loop, service: GPS):
@@ -86,7 +83,7 @@ async def test_disable_recording(event_loop, service: GPS):
assert resp.status == 'success', resp.info
-@pytest.mark.gps
+
@pytest.mark.regular
@pytest.mark.dependency
async def test_subscribe_location(event_loop, service: GPS):
@@ -95,7 +92,7 @@ async def test_subscribe_location(event_loop, service: GPS):
assert resp.msgid == msgid
assert resp.status == 'success'
-@pytest.mark.gps
+
@pytest.mark.hwrequired
@pytest.mark.dependency(depends=['test_subscribe_location'])
@pytest.mark.xfail # expecting this to fail because of "No 3D GNSS fix" and GPS is unavailable
@@ -114,7 +111,6 @@ async def test_location_events(event_loop, service: GPS):
pytest.xfail("Did not receive location event")
-@pytest.mark.gps
@pytest.mark.regular
async def test_unsubscribe(event_loop, service: GPS):
msgid = await service.unsubscribe('location')
diff --git a/pyagl/tests/test_mediascanner.py b/pyagl/tests/test_mediascanner.py
index 82bc407..a4d57ee 100644
--- a/pyagl/tests/test_mediascanner.py
+++ b/pyagl/tests/test_mediascanner.py
@@ -20,7 +20,7 @@ import logging
from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.mediascanner import MediaScannerService as mss
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.mediascanner]
events = ['media_added', 'media_removed']
@pytest.fixture(scope='module')
@@ -39,7 +39,6 @@ async def service():
@pytest.mark.regular
-@pytest.mark.mediascanner
async def test_media_result(event_loop, service: mss):
msgid = await service.media_result()
resp = await service.afbresponse()
@@ -47,7 +46,6 @@ async def test_media_result(event_loop, service: mss):
@pytest.mark.regular
-@pytest.mark.mediascanner
async def test_subscribe(event_loop, service: mss):
for e in events:
msgid = await service.subscribe(e)
@@ -56,7 +54,6 @@ async def test_subscribe(event_loop, service: mss):
@pytest.mark.regular
-@pytest.mark.mediascanner
async def test_unsubscribe(event_loop, service: mss):
for e in events:
msgid = await service.unsubscribe(e)
diff --git a/pyagl/tests/test_network.py b/pyagl/tests/test_network.py
index bff18d3..2eb4ebc 100644
--- a/pyagl/tests/test_network.py
+++ b/pyagl/tests/test_network.py
@@ -20,7 +20,7 @@ import logging
from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.network import NetworkService as NS
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.network]
@pytest.fixture(scope='module')
@@ -44,7 +44,6 @@ def expected_available_techs():
return techs
-@pytest.mark.network
@pytest.mark.regular
async def test_state(event_loop, service: NS):
msgid = await service.state()
@@ -53,7 +52,6 @@ async def test_state(event_loop, service: NS):
assert resp.data == 'online'
-@pytest.mark.network
@pytest.mark.regular
async def test_global_offline(event_loop, service: NS):
addr, _ = service.websocket.remote_address
@@ -65,7 +63,6 @@ async def test_global_offline(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_scan_services(event_loop, service: NS, expected_available_techs):
scannable_techs = ['wifi', 'bluetooth']
@@ -76,7 +73,6 @@ async def test_scan_services(event_loop, service: NS, expected_available_techs):
assert resp.status == 'success', f'scan_services failed for technology {t} - {resp.info}'
-@pytest.mark.network
@pytest.mark.regular
async def test_global_online(event_loop, service: NS):
msgid = await service.offline(False)
@@ -84,7 +80,6 @@ async def test_global_online(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
@pytest.mark.dependency
async def test_technologies_verb(event_loop, service: NS):
@@ -94,7 +89,6 @@ async def test_technologies_verb(event_loop, service: NS):
assert 'values' in resp.data
-@pytest.mark.network
@pytest.mark.regular
@pytest.mark.dependency(depends=['test_technologies_verb'])
async def test_expected_existing_technologies(event_loop, service: NS, expected_available_techs):
@@ -105,7 +99,6 @@ async def test_expected_existing_technologies(event_loop, service: NS, expected_
assert t in techs, f'"{t}" technology is expected to be available, but it is not'
-@pytest.mark.network
@pytest.mark.regular
@pytest.mark.dependency(depends=['test_expected_existing_technologies'])
async def test_get_property(event_loop, service: NS, expected_available_techs):
@@ -120,7 +113,6 @@ async def test_get_property(event_loop, service: NS, expected_available_techs):
assert len(diverging_fields) == 0, f'the following property fields are diverging from the expected: {diverging_fields}'
-@pytest.mark.network
@pytest.mark.regular
@pytest.mark.xfail(reason='Expecting this to throw "permission denied" via the API, tethering from connmanctl succeeds')
async def test_enable_wifi_tethering(event_loop, service: NS, expected_available_techs):
@@ -133,7 +125,6 @@ async def test_enable_wifi_tethering(event_loop, service: NS, expected_available
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
@pytest.mark.dependency(depends='test_enable_wifi_tethering')
async def test_disable_wifi_tethering(event_loop, service: NS, expected_available_techs):
@@ -144,7 +135,7 @@ async def test_disable_wifi_tethering(event_loop, service: NS, expected_availabl
assert resp.status == 'success', resp.info
-#@pytest.mark.network
+#
#@pytest.mark.regular
# async def test_set_property(event_loop, service: NS, expected_available_techs):
# for t in expected_available_techs:
@@ -154,7 +145,6 @@ async def test_disable_wifi_tethering(event_loop, service: NS, expected_availabl
# print(resp)
-@pytest.mark.network
@pytest.mark.regular
async def test_services_verb(event_loop, service: NS):
msgid = await service.services()
@@ -163,7 +153,6 @@ async def test_services_verb(event_loop, service: NS):
assert 'values' in resp.data
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_global_state(event_loop, service: NS):
msgid = await service.subscribe('global_state')
@@ -171,7 +160,6 @@ async def test_subscribe_global_state(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_global_state(event_loop, service: NS):
msgid = await service.unsubscribe('global_state')
@@ -179,7 +167,6 @@ async def test_unsubscribe_global_state(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_technologies(event_loop, service: NS):
msgid = await service.subscribe('technologies')
@@ -187,7 +174,6 @@ async def test_subscribe_technologies(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_technologies(event_loop, service: NS):
msgid = await service.unsubscribe('technologies')
@@ -195,7 +181,6 @@ async def test_unsubscribe_technologies(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_tech_props(event_loop, service: NS):
msgid = await service.subscribe('technology_properties')
@@ -203,7 +188,6 @@ async def test_subscribe_tech_props(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_tech_props(event_loop, service: NS):
msgid = await service.unsubscribe('technology_properties')
@@ -211,7 +195,6 @@ async def test_unsubscribe_tech_props(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_services(event_loop, service: NS):
msgid = await service.subscribe('services')
@@ -219,7 +202,6 @@ async def test_subscribe_services(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_services(event_loop, service: NS):
msgid = await service.unsubscribe('services')
@@ -227,7 +209,6 @@ async def test_unsubscribe_services(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_service_props(event_loop, service: NS):
msgid = await service.subscribe('service_properties')
@@ -235,7 +216,6 @@ async def test_subscribe_service_props(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_service_props(event_loop, service: NS):
msgid = await service.unsubscribe('service_properties')
@@ -243,7 +223,6 @@ async def test_unsubscribe_service_props(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_subscribe_agent(event_loop, service: NS):
msgid = await service.subscribe('agent')
@@ -251,7 +230,6 @@ async def test_subscribe_agent(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_unsubscribe_agent(event_loop, service: NS):
msgid = await service.unsubscribe('agent')
@@ -259,7 +237,6 @@ async def test_unsubscribe_agent(event_loop, service: NS):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_enable_wifi(event_loop, service: NS, expected_available_techs):
if 'wifi' not in expected_available_techs:
@@ -269,7 +246,6 @@ async def test_enable_wifi(event_loop, service: NS, expected_available_techs):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_disable_wifi(event_loop, service: NS, expected_available_techs):
if 'wifi' not in expected_available_techs:
@@ -279,7 +255,6 @@ async def test_disable_wifi(event_loop, service: NS, expected_available_techs):
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_enable_bluetooth(event_loop, service: NS, expected_available_techs):
if 'bluetooth' not in expected_available_techs:
@@ -289,7 +264,6 @@ async def test_enable_bluetooth(event_loop, service: NS, expected_available_tech
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_disable_bluetooth(event_loop, service: NS, expected_available_techs):
if 'bluetooth' not in expected_available_techs:
@@ -299,7 +273,6 @@ async def test_disable_bluetooth(event_loop, service: NS, expected_available_tec
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_enable_ethernet(event_loop, service: NS, expected_available_techs):
if 'ethernet' not in expected_available_techs:
@@ -309,7 +282,6 @@ async def test_enable_ethernet(event_loop, service: NS, expected_available_techs
assert resp.status == 'success', resp.info
-@pytest.mark.network
@pytest.mark.regular
async def test_disable_ethernet(event_loop, service: NS, expected_available_techs):
addr, _ = service.websocket.remote_address
diff --git a/pyagl/tests/test_nfc.py b/pyagl/tests/test_nfc.py
index 23ad961..d7b3334 100644
--- a/pyagl/tests/test_nfc.py
+++ b/pyagl/tests/test_nfc.py
@@ -21,7 +21,7 @@ from pyagl.services.base import AFBResponse, AFBT
from concurrent.futures import TimeoutError
from pyagl.services.nfc import NFCService as nfcs
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.nfc]
@pytest.fixture(scope='module')
@@ -39,7 +39,6 @@ async def service():
await svc.websocket.close()
-@pytest.mark.nfc
@pytest.mark.regular
async def subscribe(event_loop, service: nfcs):
msgid = service.subscribe()
@@ -47,7 +46,6 @@ async def subscribe(event_loop, service: nfcs):
assert resp.msgid == msgid
-@pytest.mark.nfc
@pytest.mark.regular
async def unsubscribe(event_loop, service: nfcs):
msgid = service.unsubscribe()
diff --git a/pyagl/tests/test_weather.py b/pyagl/tests/test_weather.py
index 2dd0806..2c68152 100644
--- a/pyagl/tests/test_weather.py
+++ b/pyagl/tests/test_weather.py
@@ -20,7 +20,7 @@ import logging
from pyagl.services.base import AFBResponse, AFBT
from pyagl.services.weather import WeatherService as ws
-pytestmark = pytest.mark.asyncio
+pytestmark = [pytest.mark.asyncio, pytest.mark.weather, pytest.mark.regular]
@pytest.fixture(scope='module')
@@ -38,8 +38,6 @@ async def service():
await gpss.websocket.close()
-@pytest.mark.weather
-@pytest.mark.regular
async def test_apikey(event_loop, service: ws):
msgid = await service.apikey()
resp = await service.afbresponse()
@@ -47,8 +45,6 @@ async def test_apikey(event_loop, service: ws):
assert resp.data['api_key'] == 'a860fa437924aec3d0360cc749e25f0e'
-@pytest.mark.weather
-@pytest.mark.regular
async def test_current_weather(event_loop, service: ws):
msgid = await service.current_weather()
resp = await service.afbresponse()
@@ -56,24 +52,18 @@ async def test_current_weather(event_loop, service: ws):
assert 'sys' in resp.data
-@pytest.mark.weather
-@pytest.mark.regular
async def test_bad_subscription(event_loop, service: ws):
msgid = await service.subscribe('non-existant')
resp = await service.afbresponse()
assert resp.status == 'failed'
-@pytest.mark.weather
-@pytest.mark.regular
async def test_bad_unsubscription(event_loop, service: ws):
msgid = await service.unsubscribe('non-existant')
resp = await service.afbresponse()
assert resp.status == 'failed'
-@pytest.mark.weather
-@pytest.mark.regular
@pytest.mark.dependency
async def test_subscribe_weather(event_loop, service: ws):
event = 'weather'
@@ -84,8 +74,6 @@ async def test_subscribe_weather(event_loop, service: ws):
assert eventresp.api == f'{service.api}/{event}'
-@pytest.mark.weather
-@pytest.mark.regular
@pytest.mark.dependency(depends=['test_subscribe_weather'])
async def test_unsubscribe_weather(event_loop, service: ws):
msgid = await service.subscribe('weather')