Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ filterwarnings = [
"ignore::DeprecationWarning:pkg_resources",
"ignore::DeprecationWarning:google",
"ignore::DeprecationWarning:importlib",
"ignore::pytest_benchmark.logger.PytestBenchmarkWarning",
]
# pytest-benchmark settings (pass via CLI: --benchmark-min-rounds=3 --benchmark-max-time=30.0)
# benchmark_ prefix keys are NOT supported as ini_options in pytest-benchmark 5.x
Expand Down
12 changes: 10 additions & 2 deletions tests/api/test_realtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ class TestConnectionManager:
"""Tests for ConnectionManager."""

@pytest.fixture
def manager(self):
return ConnectionManager()
async def manager(self):
m = ConnectionManager()
yield m
if m._queue_task is not None and not m._queue_task.done():
m._queue_task.cancel()
try:
await m._queue_task
except asyncio.CancelledError:
pass

@pytest.fixture
def mock_ws(self):
Expand Down Expand Up @@ -298,6 +305,7 @@ async def failing_coro():

task = asyncio.create_task(failing_coro())
await asyncio.sleep(0.01)

# Should not raise, just log
await manager._await_task(task)

Expand Down
19 changes: 19 additions & 0 deletions tests/integration/test_copilot_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

from __future__ import annotations

from unittest.mock import patch

import pytest

from file_organizer.services.copilot.conversation import ConversationManager
Expand All @@ -19,6 +21,23 @@
pytestmark = pytest.mark.integration


@pytest.fixture(scope="function", autouse=True)
def mock_directory_tree():
"""Mock DirectoryTree to prevent coroutine creation in copilot tests."""
def mock_init(self, *args, **kwargs):
"""Mock DirectoryTree.__init__ to prevent async watch_path coroutine."""
return None

def mock_reload(self):
"""Mock DirectoryTree.reload to prevent async _reload coroutine."""
return None

with patch("textual.widgets.DirectoryTree.__init__", mock_init), patch(
"textual.widgets.DirectoryTree.reload", mock_reload
):
yield


def _user(content: str) -> CopilotMessage:
return CopilotMessage(role=MessageRole.USER, content=content)

Expand Down
Loading
Loading