diff --git a/getstream/version.py b/getstream/version.py index d861c14e..d8e2d7f5 100644 --- a/getstream/version.py +++ b/getstream/version.py @@ -1 +1,3 @@ -VERSION = "2.5.18" +from importlib.metadata import version + +VERSION = version("getstream") diff --git a/tests/conftest.py b/tests/conftest.py index f54acd52..ae608f64 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,3 +1,4 @@ +import functools import pytest import os from dotenv import load_dotenv @@ -45,3 +46,19 @@ def pytest_runtest_setup(item): skip_in_ci_marker = item.get_closest_marker("skip_in_ci") if skip_in_ci_marker is not None: pytest.skip("Test skipped in CI environment") + + +def skip_on_rate_limit(func): + """Skip test if it fails due to rate limiting.""" + from getstream.video.rtc.coordinator.errors import StreamWSConnectionError + + @functools.wraps(func) + async def wrapper(*args, **kwargs): + try: + return await func(*args, **kwargs) + except StreamWSConnectionError as e: + if "did not receive a valid http response" in str(e).lower(): + pytest.skip(f"Skipped due to rate limiting: {e}") + raise + + return wrapper diff --git a/tests/rtc/coordinator/test_connect.py b/tests/rtc/coordinator/test_connect.py index 298e5664..3d2d156a 100644 --- a/tests/rtc/coordinator/test_connect.py +++ b/tests/rtc/coordinator/test_connect.py @@ -14,6 +14,7 @@ StreamWSConnectionError, ) from getstream.stream import Stream +from tests.conftest import skip_on_rate_limit @pytest.mark.asyncio @@ -372,6 +373,7 @@ async def test_integration_test_simple_healthcheck(client: Stream): @pytest.mark.asyncio +@skip_on_rate_limit async def test_integration_test_user_details_in_response(client: Stream): """Test that user details are returned in the 'me' field of the connection response.""" user_details = {