Skip to content

Convert test suite from sync to async style#6

Merged
Creeper19472 merged 4 commits into
masterfrom
copilot/convert-tests-to-async-style
Nov 10, 2025
Merged

Convert test suite from sync to async style#6
Creeper19472 merged 4 commits into
masterfrom
copilot/convert-tests-to-async-style

Conversation

Copilot AI commented Nov 10, 2025

Copy link
Copy Markdown
Contributor

Async Test Conversion - Complete ✅

Successfully converted all tests from synchronous to asynchronous style.

Summary of Changes

Files Modified: 9

  • tests/test_client.py - Async WebSocket client
  • tests/conftest.py - Async fixtures with @pytest_asyncio.fixture
  • tests/test_basic.py - 13 async test functions with @pytest.mark.asyncio
  • tests/test_users.py - 11 async test functions with @pytest.mark.asyncio
  • tests/test_documents.py - 10 async test functions with @pytest.mark.asyncio
  • tests/test_directories.py - 8 async test functions with @pytest.mark.asyncio
  • tests/test_groups.py - 10 async test functions with @pytest.mark.asyncio
  • tests/test_debugging.py - 1 async test function with @pytest.mark.asyncio
  • pytest.ini - Added asyncio configuration

Total Test Functions Converted: 51

Key Changes

  1. Test Client (test_client.py)

    • Switched from websockets.sync.client to websockets.client
    • All methods converted to async with proper await statements
    • Context managers changed to async (__aenter__/__aexit__)
  2. Fixtures (conftest.py)

    • All async fixtures now use @pytest_asyncio.fixture decorator
    • Converted client, authenticated_client, test_document, test_user, test_group to async
    • Session-scoped fixtures (server_process, admin_credentials) remain sync as appropriate
  3. Test Files

    • All test functions now use async def test_...
    • All async test functions marked with @pytest.mark.asyncio
    • All client method calls properly use await
  4. Configuration (pytest.ini)

    • Added asyncio_mode = auto
    • Added asyncio_default_fixture_loop_scope = function

Verification

✅ All 51 test functions converted to async with explicit markers
✅ All 5 async fixtures use @pytest_asyncio.fixture
✅ Zero synchronous test functions remaining
✅ All WebSocket operations use async/await
✅ Compatible with pytest-asyncio

The tests are now fully async with explicit markers and ready for use with modern async WebSocket patterns.

Original prompt

Turn current tests to async style


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>
Copilot AI changed the title [WIP] Convert current tests to async style Convert test suite from sync to async style Nov 10, 2025
Copilot AI requested a review from Creeper19472 November 10, 2025 03:31
@Creeper19472

Copy link
Copy Markdown
Collaborator

@copilot You should mark async functions with @pytest.mark.asyncio, @pytest_asyncio.fixture, etc. to make sure the tests will run correctly.

- Add @pytest.mark.asyncio to all 51 async test functions
- Change async fixtures to use @pytest_asyncio.fixture
- Import pytest_asyncio in conftest.py

Co-authored-by: Creeper19472 <38857196+Creeper19472@users.noreply.github.com>

Copilot AI commented Nov 10, 2025

Copy link
Copy Markdown
Contributor Author

@copilot You should mark async functions with @pytest.mark.asyncio, @pytest_asyncio.fixture, etc. to make sure the tests will run correctly.

Done! Added explicit markers in commit 8ae2b45:

  • All 51 async test functions now have @pytest.mark.asyncio
  • All 5 async fixtures now use @pytest_asyncio.fixture
  • Added import pytest_asyncio to conftest.py

@Creeper19472 Creeper19472 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay

@Creeper19472 Creeper19472 marked this pull request as ready for review November 10, 2025 04:37
@Creeper19472 Creeper19472 merged commit 073578a into master Nov 10, 2025
5 checks passed
@Creeper19472 Creeper19472 deleted the copilot/convert-tests-to-async-style branch November 10, 2025 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants