Skip to content

Commit 63ac23c

Browse files
committed
Add test github action
1 parent eb799d5 commit 63ac23c

File tree

10 files changed

+150
-17
lines changed

10 files changed

+150
-17
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Python CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.10'
18+
- name: Install uv
19+
uses: astral-sh/setup-uv@v5
20+
with:
21+
enable-cache: true
22+
- name: Run tests
23+
run: |
24+
uv sync --group dev
25+
uv run pytest
26+
27+
lint:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: '3.10'
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
- name: Check code style with ruff
40+
run: |
41+
uv sync --group dev
42+
uv run ruff check src/ tests/

pyproject.toml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ dependencies = [
3131
"openai>=1.72.0",
3232
"aiohttp>=3.11.16",
3333
"watchfiles>=1.0.4",
34+
"duckdb>=1.2.2",
3435
]
3536

3637
[project.urls]
@@ -52,8 +53,14 @@ line-length = 120
5253
fix = true
5354

5455
[tool.ruff.lint]
55-
select = ["F", "E", "W", "I"]
56-
fixable = ["I", "F401"]
56+
select = ["E", "F", "W", "Q", "I"]
57+
fixable = ["ALL"]
58+
ignore = ["E501"]
5759

5860
[dependency-groups]
59-
dev = ["ipython>=8.34.0", "pytest>=8.3.5"]
61+
dev = [
62+
"ipython>=8.34.0",
63+
"pytest>=8.3.5",
64+
"pytest-asyncio>=0.26.0",
65+
"ruff>=0.11.4",
66+
]

src/mcpm/commands/inspector.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
MCPM Inspector command for examining MCP servers through a user interface
33
"""
44

5-
import click
65
import os
7-
import subprocess
86
import shlex
7+
import subprocess
98
import sys
9+
10+
import click
1011
from rich.console import Console
1112
from rich.panel import Panel
1213

src/mcpm/commands/list.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def list():
4646
return
4747

4848
# Count the configured servers
49-
server_count = len(servers)
50-
stashed_count = len(stashed_servers)
49+
len(servers)
50+
len(stashed_servers)
5151

5252
# Print active servers
5353
if servers:

src/mcpm/monitor/duckdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _initialize_storage_impl(self) -> bool:
6767
# Create the events table if it doesn't exist using identity column for auto-incrementing
6868
self.connection.execute("""
6969
CREATE SEQUENCE IF NOT EXISTS event_id_seq;
70-
70+
7171
CREATE TABLE IF NOT EXISTS monitor_events (
7272
id INTEGER DEFAULT nextval('event_id_seq') PRIMARY KEY,
7373
event_type VARCHAR,
@@ -88,7 +88,7 @@ def _initialize_storage_impl(self) -> bool:
8888

8989
# Create a backward compatibility view
9090
self.connection.execute("""
91-
CREATE VIEW IF NOT EXISTS access_events AS
91+
CREATE VIEW IF NOT EXISTS access_events AS
9292
SELECT * FROM monitor_events
9393
""")
9494

src/mcpm/utils/display.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,5 @@ def print_client_error(client_name):
9292
Args:
9393
client_name: Name of the client that caused the error
9494
"""
95-
console.print(f"[bold red]Error:[/] Unsupported active client")
96-
console.print(f"Please switch to a supported client using 'mcpm client <client-name>'")
95+
console.print("[bold red]Error:[/] Unsupported active client")
96+
console.print("Please switch to a supported client using 'mcpm client <client-name>'")

src/mcpm/utils/repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import logging
77
import os
88
from datetime import datetime
9-
from pathlib import Path
10-
from typing import Dict, List, Optional, Any
9+
from typing import Any, Dict, List, Optional
10+
1111
import requests
1212

1313
# Import ConfigManager to get the config directory

tests/test_access_monitor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ async def test_track_event(temp_db_path):
6161

6262
# Query the database directly to check if the event was recorded
6363
result = monitor.connection.execute("""
64-
SELECT * FROM monitor_events
65-
WHERE server_id = 'test-server'
64+
SELECT * FROM monitor_events
65+
WHERE server_id = 'test-server'
6666
AND resource_id = 'test-tool'
6767
""").fetchall()
6868

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def test_client_set_command_unsupported(monkeypatch):
108108
assert "Error" in result.output
109109
assert "Unknown client: unsupported-client" in result.output
110110
# Verify supported clients are listed
111-
for client in supported_clients:
112-
assert client in result.output
111+
for supported_client in supported_clients:
112+
assert supported_client in result.output
113113

114114

115115
def test_client_set_command_failure(monkeypatch):

uv.lock

Lines changed: 83 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)