Skip to content
Merged
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
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ jobs:
name: jupyter_mcp_server-sdist-${{ matrix.python-version }}
path: jupyter_mcp_server.tar.gz

check_links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1
# check_links:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v5
# - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
# - uses: jupyterlab/maintainer-tools/.github/actions/check-links@v1

test_lint:
runs-on: ubuntu-latest
Expand Down
49 changes: 4 additions & 45 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from contextlib import AsyncExitStack

import pytest
import requests
from mcp import ClientSession, types
from mcp.client.streamable_http import streamablehttp_client

Expand Down Expand Up @@ -346,30 +347,9 @@ async def read_cells(self):
@requires_session
async def list_cells(self, max_retries=3):
"""List cells with retry mechanism for Windows compatibility"""
for attempt in range(max_retries):
try:
result = await self._session.call_tool("list_cells") # type: ignore
text_result = self._extract_text_content(result)
logging.debug(f"list_cells attempt {attempt + 1}: text_result type={type(text_result)}, len={len(text_result) if text_result else 0}")
logging.debug(f"list_cells attempt {attempt + 1}: text_result[:500]={repr(text_result[:500]) if text_result else 'None'}")
has_index_type = ("Index\tType" in text_result) if text_result else False
logging.debug(f"list_cells attempt {attempt + 1}: has_index_type={has_index_type}")
if text_result is not None and not text_result.startswith("Error") and "Index\tType" in text_result:
return text_result
else:
logging.warning(f"list_cells returned unexpected result on attempt {attempt + 1}/{max_retries}")
if attempt < max_retries - 1:
await asyncio.sleep(0.5)
except Exception as e:
logging.error(f"list_cells failed on attempt {attempt + 1}/{max_retries}: {e}")
if attempt < max_retries - 1:
await asyncio.sleep(0.5)
else:
logging.error("list_cells failed after all retries")
return "Error: Failed to retrieve cell list after all retries"

return "Error: Failed to retrieve cell list after all retries"

result = await self._session.call_tool("list_cells") # type: ignore
return self._extract_text_content(result)

@requires_session
async def list_kernels(self):
"""List all available kernels"""
Expand Down Expand Up @@ -437,24 +417,3 @@ async def execute_code(self, code, timeout=60):
structured["result"] = [result_val]

return structured

@requires_session
async def append_execute_code_cell(self, cell_source):
"""Append and execute a code cell at the end of the notebook."""
return await self.insert_execute_code_cell(-1, cell_source)

@requires_session
async def append_markdown_cell(self, cell_source):
"""Append a markdown cell at the end of the notebook."""
return await self.insert_cell(-1, "markdown", cell_source)

# Helper method to get cell count from list_cells output
@requires_session
async def get_cell_count(self):
"""Get the number of cells by parsing list_cells output"""
cell_list = await self.list_cells()
if "Error" in cell_list or "Index\tType" not in cell_list:
return 0
lines = cell_list.split('\n')
data_lines = [line for line in lines if '\t' in line and not line.startswith('Index') and not line.startswith('-')]
return len(data_lines)
133 changes: 0 additions & 133 deletions tests/test_list_kernels.py

This file was deleted.

Loading
Loading