Skip to content

Commit e3540da

Browse files
committed
ongoing
1 parent 79a2b37 commit e3540da

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/copilot-instructions.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ This document provides guidelines and best practices for using GitHub Copilot in
2323
- ensure we use `fastapi` >0.100 compatible code
2424
- use f-string formatting
2525
- Only add comments in function if strictly necessary
26+
- use relative imports
27+
- imports should be at top of the file
2628

2729

2830
### Json serialization

services/web/server/tests/unit/with_dbs/04/notifications/test_notifications__db_comp_tasks_listening_task.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import json
88
import logging
9+
import secrets
910
from collections.abc import AsyncIterator, Awaitable, Callable
1011
from dataclasses import dataclass
1112
from typing import Any
@@ -147,7 +148,7 @@ async def _assert_listener_triggers(
147148
],
148149
)
149150
@pytest.mark.parametrize("user_role", [UserRole.USER])
150-
async def test_db_listener_triggers_on_event(
151+
async def test_db_listener_triggers_on_event_with_multiple_tasks(
151152
sqlalchemy_async_engine: AsyncEngine,
152153
mock_project_subsystem: dict[str, mock.Mock],
153154
logged_user: UserInfoDict,
@@ -161,18 +162,21 @@ async def test_db_listener_triggers_on_event(
161162
):
162163
some_project = await project(logged_user)
163164
pipeline(project_id=f"{some_project.uuid}")
164-
task = comp_task(
165-
project_id=f"{some_project.uuid}",
166-
node_id=faker.uuid4(),
167-
outputs=json.dumps({}),
168-
node_class=task_class,
169-
)
165+
# Create 3 tasks with different node_ids
166+
tasks = [
167+
comp_task(
168+
project_id=f"{some_project.uuid}",
169+
node_id=faker.uuid4(),
170+
outputs=json.dumps({}),
171+
node_class=task_class,
172+
)
173+
for _ in range(3)
174+
]
175+
random_task_to_update = tasks[secrets.randbelow(len(tasks))]
170176
async with sqlalchemy_async_engine.begin() as conn:
171-
# let's update some values
172177
await conn.execute(
173178
comp_tasks.update()
174179
.values(**params.update_values)
175-
.where(comp_tasks.c.task_id == task["task_id"])
180+
.where(comp_tasks.c.task_id == random_task_to_update["task_id"])
176181
)
177-
178182
await _assert_listener_triggers(mock_project_subsystem, params.expected_calls)

0 commit comments

Comments
 (0)