Skip to content

Conversation

@Zsailer
Copy link
Collaborator

@Zsailer Zsailer commented Jul 21, 2025

Summary

Added comprehensive unit and integration tests for the kernels API, including complex document-aware kernel
client testing that verifies YDoc message tracing and output handling. Also includes the previous kernel restart
fix.

Changes

Test Infrastructure

  • Created comprehensive test suite in jupyter_server_documents/tests/kernels/ with 62 tests
  • Added proper async test configuration with pytest-asyncio

Test Coverage

  • Kernel Manager Tests (8 tests) - State management, lifecycle transitions, restart functionality
  • Kernel Client Tests (9 tests) - Basic client functionality, listener management, YRoom integration
  • Multi-Kernel Manager Tests (7 tests) - Multi-kernel management and restart operations
  • States Tests (15 tests) - Enum functionality for lifecycle and execution states
  • WebSocket Connection Tests (7 tests) - Message serialization, error handling, protocol validation
  • Integration Tests (11 tests) - Complex end-to-end document-aware kernel client workflows

Key Integration Test Features

The integration tests simulate real kernel execution scenarios (like 2 + 2) and verify:

  • Execute input messages properly update execution counts in YDoc
  • Status messages correctly update cell execution states (busyrunning, idle)
  • Output messages (execute_result, stream, error, display_data) are processed and stored
  • Complete execution flows work end-to-end: execute_input → status → output → status
  • Multiple cells can maintain different execution states simultaneously
  • Kernel-level status updates propagate to awareness state
  • Message processing without cell_id skips cell-specific updates

YDoc API Enhancements

  • Added get_cell_list() method to YNotebook for accessing all cells
  • Added get_meta() method to YNotebook for accessing notebook metadata
  • Fixed integration tests to use local extended YNotebook implementation

@ellisonbg
Copy link
Collaborator

ellisonbg commented Jul 22, 2025

@Zsailer can you commit your changes to pyproject.toml?

@Zsailer
Copy link
Collaborator Author

Zsailer commented Jul 22, 2025

Actually, it doesn't look like a change to the pyproject.toml is needed after all. The dependency I thought I needed was already there. I'll remove this line from the top level comment.

@Zsailer
Copy link
Collaborator Author

Zsailer commented Jul 23, 2025

Closing in favor of #146

@Zsailer Zsailer closed this Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants