diff --git a/aiobotocore/session.py b/aiobotocore/session.py index 07a1a29e..0f029f67 100644 --- a/aiobotocore/session.py +++ b/aiobotocore/session.py @@ -136,9 +136,9 @@ async def get_service_data(self, service_name, api_version=None): api_version=api_version ) service_id = EVENT_ALIASES.get(service_name, service_name) - self._events.emit('service-data-loaded.%s' % service_id, - service_data=service_data, - service_name=service_name, session=self) + await self._events.emit('service-data-loaded.%s' % service_id, + service_data=service_data, + service_name=service_name, session=self) return service_data async def get_available_regions(self, service_name, partition_name='aws', diff --git a/tests/test_session.py b/tests/test_session.py new file mode 100644 index 00000000..84e536b2 --- /dev/null +++ b/tests/test_session.py @@ -0,0 +1,16 @@ +import pytest + + +@pytest.mark.moto +@pytest.mark.asyncio +async def test_get_service_data(session): + handler_called = False + + def handler(**kwargs): + nonlocal handler_called + handler_called = True + + session.register('service-data-loaded.s3', handler) + await session.get_service_data('s3') + + assert handler_called