Skip to content

Commit

Permalink
fix(subscriptions): return import on schema and update tests using as…
Browse files Browse the repository at this point in the history
…ync_lru
  • Loading branch information
CammilleCC committed Nov 5, 2024
1 parent 8126445 commit 57215c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion api/src/damnit_api/graphql/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from strawberry.schema.config import StrawberryConfig
from strawberry.type import has_object_definition

from . import models, mutations, queries
from . import models, mutations, queries, subscriptions


class Schema(strawberry.Schema):
Expand Down
12 changes: 2 additions & 10 deletions api/tests/graphql/test_subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest_asyncio

from damnit_api.graphql.models import DamnitRun, serialize
from damnit_api.graphql.subscriptions import LATEST_DATA, POLLING_INTERVAL
from damnit_api.graphql.subscriptions import POLLING_INTERVAL

from .const import (
EXAMPLE_VARIABLES,
Expand Down Expand Up @@ -66,12 +66,6 @@ def mocked_new_count(mocker):
)


@pytest.fixture(autouse=True)
def clear_latest_data():
"""Automatically clears the latest data cache before every test."""
LATEST_DATA.clear()


@pytest.mark.asyncio
async def test_latest_data(
graphql_schema,
Expand Down Expand Up @@ -221,9 +215,7 @@ async def test_latest_data_with_nonconcurrent_subscriptions(
mocked_latest_rows.assert_called()
break

await asyncio.sleep(
POLLING_INTERVAL * 3
) # give enough time to clear the cache
await asyncio.sleep(POLLING_INTERVAL * 3) # give enough time to clear the cache
mocked_latest_rows.reset_mock()

with patched_sleep:
Expand Down

0 comments on commit 57215c4

Please sign in to comment.