Skip to content

Commit d1fbd9d

Browse files
authored
Fix/executable commands (#73)
* release: bump version to 0.4.1 (patch release) * fix running commands on project executable
1 parent 8fd4466 commit d1fbd9d

File tree

4 files changed

+62
-4
lines changed

4 files changed

+62
-4
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,15 @@ repos:
1616
hooks:
1717
# Run the linter.
1818
- id: ruff
19-
types_or: [ python, pyi ]
20-
args: [ --fix ]
19+
types_or: [python, pyi]
20+
args: [--fix]
2121
# Run the formatter.
2222
- id: ruff-format
23-
types_or: [ python, pyi ]
23+
name: ruff format
24+
entry: uv run ruff format --check
25+
language: system
26+
types_or: [python, pyi]
27+
files: ^(src|tests)/
2428

2529
- repo: local
2630
hooks:

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ dependencies = [
1313
"starlette>=0.46.2",
1414
]
1515

16+
[project.scripts]
17+
singlestore-mcp-server = "src.main:cli"
18+
1619
[build-system]
1720
requires = ["hatchling"]
1821
build-backend = "hatchling.build"

src/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.4.0"
1+
__version__ = "0.4.1"

tests/test_cli_commands.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
"""Test that verifies all CLI commands are accessible.
2+
Extracts commands from --help and tests them."""
3+
4+
import subprocess
5+
import pytest
6+
7+
8+
def get_commands():
9+
"""Get all commands by parsing --help output."""
10+
result = subprocess.run(
11+
"uvx --from . singlestore-mcp-server --help",
12+
shell=True,
13+
capture_output=True,
14+
text=True,
15+
check=True,
16+
)
17+
# Extract commands from help output (looking for "Commands:" section)
18+
commands = []
19+
in_commands = False
20+
for line in result.stdout.split("\n"):
21+
if line.strip() == "Commands:":
22+
in_commands = True
23+
continue
24+
if in_commands and line.strip():
25+
# Extract command name (first word)
26+
command = line.strip().split()[0]
27+
commands.append(command)
28+
elif in_commands and not line.strip():
29+
# Empty line after commands section
30+
break
31+
return commands
32+
33+
34+
@pytest.fixture(scope="session", autouse=True)
35+
def build_package():
36+
"""Build the package before running tests."""
37+
subprocess.run("uvx --from build pyproject-build", shell=True, check=True)
38+
39+
40+
@pytest.mark.parametrize("command", get_commands())
41+
def test_command_help(command):
42+
"""Test that each command's --help works."""
43+
result = subprocess.run(
44+
f"uvx --from . singlestore-mcp-server {command} --help",
45+
shell=True,
46+
capture_output=True,
47+
text=True,
48+
)
49+
assert result.returncode == 0, (
50+
f"Command '{command} --help' failed:\n{result.stderr}"
51+
)

0 commit comments

Comments
 (0)