Skip to content

Commit ae86ad0

Browse files
authored
Merge pull request #31 from blazickjp/feature/keep_pdf
removed unlink of pdf files
2 parents b23eae1 + 4510855 commit ae86ad0

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

src/arxiv_mcp_server/resources/papers.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ async def store_paper(self, paper_id: str, pdf_url: str) -> bool:
4343
async with aiofiles.open(paper_md_path, "w", encoding="utf-8") as f:
4444
await f.write(markdown)
4545

46-
paper_pdf_path.unlink() # Remove PDF after conversion
4746
return True
4847

4948
except StopIteration:

src/arxiv_mcp_server/tools/download.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ def convert_pdf_to_markdown(paper_id: str, pdf_path: Path) -> None:
7474
status.completed_at = datetime.now()
7575

7676
# Clean up PDF after successful conversion
77-
pdf_path.unlink()
7877
logger.info(f"Conversion completed for {paper_id}")
7978

8079
except Exception as e:

tests/prompts/test_prompt_integration.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,40 @@
33
import pytest
44
from arxiv_mcp_server.prompts.handlers import list_prompts, get_prompt
55

6+
67
@pytest.mark.asyncio
78
async def test_server_list_prompts():
89
"""Test server list_prompts endpoint."""
910
prompts = await list_prompts()
1011
assert len(prompts) == 1
11-
12+
1213
# Check that all prompts have required fields
1314
for prompt in prompts:
1415
assert prompt.name
1516
assert prompt.description
1617
assert prompt.arguments is not None
1718

19+
1820
@pytest.mark.asyncio
1921
async def test_server_get_analysis_prompt():
2022
"""Test server get_prompt endpoint with analysis prompt."""
21-
result = await get_prompt(
22-
"deep-paper-analysis",
23-
{"paper_id": "2401.00123"}
24-
)
25-
23+
result = await get_prompt("deep-paper-analysis", {"paper_id": "2401.00123"})
24+
2625
assert len(result.messages) == 1
2726
message = result.messages[0]
2827
assert message.role == "user"
2928
assert "2401.00123" in message.content.text
3029

30+
3131
@pytest.mark.asyncio
3232
async def test_server_get_prompt_invalid_name():
3333
"""Test server get_prompt endpoint with invalid prompt name."""
3434
with pytest.raises(ValueError, match="Prompt not found"):
3535
await get_prompt("invalid-prompt", {})
3636

37+
3738
@pytest.mark.asyncio
3839
async def test_server_get_prompt_missing_args():
3940
"""Test server get_prompt endpoint with missing required arguments."""
4041
with pytest.raises(ValueError, match="Missing required argument"):
41-
await get_prompt("deep-paper-analysis", {})
42+
await get_prompt("deep-paper-analysis", {})

tests/prompts/test_prompts.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,49 @@
55
from arxiv_mcp_server.prompts.handlers import list_prompts, get_prompt
66
from mcp.types import GetPromptResult, PromptMessage, TextContent
77

8+
89
@pytest.mark.asyncio
910
async def test_list_prompts():
1011
"""Test listing available prompts."""
1112
prompts = await list_prompts()
1213
assert len(prompts) == 1
13-
14+
1415
prompt_names = {p.name for p in prompts}
1516
expected_names = {"deep-paper-analysis"}
1617
assert prompt_names == expected_names
1718

19+
1820
@pytest.mark.asyncio
1921
async def test_get_paper_analysis_prompt():
2022
"""Test getting paper analysis prompt."""
21-
result = await get_prompt(
22-
"deep-paper-analysis",
23-
{"paper_id": "2401.00123"}
24-
)
25-
23+
result = await get_prompt("deep-paper-analysis", {"paper_id": "2401.00123"})
24+
2625
assert isinstance(result, GetPromptResult)
2726
assert len(result.messages) == 1
2827
message = result.messages[0]
29-
28+
3029
assert isinstance(message, PromptMessage)
3130
assert message.role == "user"
3231
assert isinstance(message.content, TextContent)
3332
assert "2401.00123" in message.content.text
3433

34+
3535
@pytest.mark.asyncio
3636
async def test_get_prompt_with_invalid_name():
3737
"""Test getting prompt with invalid name."""
3838
with pytest.raises(ValueError, match="Prompt not found"):
3939
await get_prompt("invalid-prompt", {})
4040

41+
4142
@pytest.mark.asyncio
4243
async def test_get_prompt_with_no_arguments():
4344
"""Test getting prompt with no arguments."""
4445
with pytest.raises(ValueError, match="No arguments provided"):
4546
await get_prompt("deep-paper-analysis", None)
4647

48+
4749
@pytest.mark.asyncio
4850
async def test_get_prompt_with_missing_required_argument():
4951
"""Test getting prompt with missing required argument."""
5052
with pytest.raises(ValueError, match="Missing required argument"):
51-
await get_prompt("deep-paper-analysis", {})
53+
await get_prompt("deep-paper-analysis", {})

0 commit comments

Comments
 (0)