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
10 changes: 7 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ repos:
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi ]
args: [ --fix ]
types_or: [python, pyi]
args: [--fix]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi ]
name: ruff format
entry: uv run ruff format --check
language: system
types_or: [python, pyi]
files: ^(src|tests)/

- repo: local
hooks:
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ dependencies = [
"starlette>=0.46.2",
]

[project.scripts]
singlestore-mcp-server = "src.main:cli"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.4.0"
__version__ = "0.4.1"
51 changes: 51 additions & 0 deletions tests/test_cli_commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
"""Test that verifies all CLI commands are accessible.
Extracts commands from --help and tests them."""

import subprocess
import pytest


def get_commands():
"""Get all commands by parsing --help output."""
result = subprocess.run(
"uvx --from . singlestore-mcp-server --help",
shell=True,
capture_output=True,
text=True,
check=True,
)
# Extract commands from help output (looking for "Commands:" section)
commands = []
in_commands = False
for line in result.stdout.split("\n"):
if line.strip() == "Commands:":
in_commands = True
continue
if in_commands and line.strip():
# Extract command name (first word)
command = line.strip().split()[0]
commands.append(command)
elif in_commands and not line.strip():
# Empty line after commands section
break
return commands


@pytest.fixture(scope="session", autouse=True)
def build_package():
"""Build the package before running tests."""
subprocess.run("uvx --from build pyproject-build", shell=True, check=True)


@pytest.mark.parametrize("command", get_commands())
def test_command_help(command):
"""Test that each command's --help works."""
result = subprocess.run(
f"uvx --from . singlestore-mcp-server {command} --help",
shell=True,
capture_output=True,
text=True,
)
assert result.returncode == 0, (
f"Command '{command} --help' failed:\n{result.stderr}"
)