style: apply ruff format to all source and test files

Fixes ruff format --check CI failure. 22 files reformatted to satisfy
the ruff formatter's style requirements. No logic changes, only
whitespace/formatting adjustments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-02-18 22:50:05 +03:00
parent 0878ad3ef6
commit 4b89e0a015
22 changed files with 707 additions and 597 deletions

View File

@@ -122,6 +122,7 @@ class TestCreateCommandArgvForwarding:
def _make_args(self, **kwargs):
import argparse
defaults = {
"enhance_workflow": None,
"enhance_stage": None,
@@ -149,6 +150,7 @@ class TestCreateCommandArgvForwarding:
def _collect_argv(self, args):
from skill_seekers.cli.create_command import CreateCommand
cmd = CreateCommand(args)
argv = []
cmd._add_common_args(argv)

View File

@@ -222,7 +222,7 @@ class TestMarkdownParser:
@pytest.fixture
def md_content(self):
return '''---
return """---
title: Test Document
description: A test markdown file
---
@@ -271,7 +271,7 @@ def hello_world():
## Image
![Alt text](image.png)
'''
"""
@pytest.fixture
def parsed_doc(self, md_content):

View File

@@ -337,10 +337,13 @@ class TestRunWorkflowsDryRun:
mock_engine.workflow.description = "desc"
mock_engine.workflow.stages = []
with patch(
"skill_seekers.cli.enhancement_workflow.WorkflowEngine",
return_value=mock_engine,
), pytest.raises(SystemExit) as exc:
with (
patch(
"skill_seekers.cli.enhancement_workflow.WorkflowEngine",
return_value=mock_engine,
),
pytest.raises(SystemExit) as exc,
):
run_workflows(args)
assert exc.value.code == 0
@@ -361,10 +364,13 @@ class TestRunWorkflowsDryRun:
m.workflow.stages = []
engines.append(m)
with patch(
"skill_seekers.cli.enhancement_workflow.WorkflowEngine",
side_effect=engines,
), pytest.raises(SystemExit):
with (
patch(
"skill_seekers.cli.enhancement_workflow.WorkflowEngine",
side_effect=engines,
),
pytest.raises(SystemExit),
):
run_workflows(args)
for engine in engines:

View File

@@ -45,14 +45,13 @@ INVALID_YAML_NO_STAGES = textwrap.dedent("""\
# Fixtures & helpers
# ─────────────────────────────────────────────────────────────────────────────
@pytest.fixture
def tmp_user_dir(tmp_path, monkeypatch):
"""Redirect USER_WORKFLOWS_DIR in workflow_tools to a temp dir."""
fake_dir = tmp_path / "workflows"
fake_dir.mkdir()
monkeypatch.setattr(
"skill_seekers.mcp.tools.workflow_tools.USER_WORKFLOWS_DIR", fake_dir
)
monkeypatch.setattr("skill_seekers.mcp.tools.workflow_tools.USER_WORKFLOWS_DIR", fake_dir)
return fake_dir
@@ -66,6 +65,7 @@ def _mock_bundled_names(names=("default", "security-focus")):
def _mock_bundled_text(mapping: dict):
def _read(name):
return mapping.get(name)
return patch(
"skill_seekers.mcp.tools.workflow_tools._read_bundled",
side_effect=_read,
@@ -84,6 +84,7 @@ def _text(result) -> str:
# list_workflows_tool
# ─────────────────────────────────────────────────────────────────────────────
class TestListWorkflowsTool:
def test_lists_bundled_and_user(self, tmp_user_dir):
from skill_seekers.mcp.tools.workflow_tools import list_workflows_tool
@@ -116,6 +117,7 @@ class TestListWorkflowsTool:
# get_workflow_tool
# ─────────────────────────────────────────────────────────────────────────────
class TestGetWorkflowTool:
def test_get_bundled(self):
from skill_seekers.mcp.tools.workflow_tools import get_workflow_tool
@@ -155,6 +157,7 @@ class TestGetWorkflowTool:
# create_workflow_tool
# ─────────────────────────────────────────────────────────────────────────────
class TestCreateWorkflowTool:
def test_create_new_workflow(self, tmp_user_dir):
from skill_seekers.mcp.tools.workflow_tools import create_workflow_tool
@@ -174,9 +177,7 @@ class TestCreateWorkflowTool:
def test_create_invalid_yaml(self, tmp_user_dir):
from skill_seekers.mcp.tools.workflow_tools import create_workflow_tool
result = create_workflow_tool(
{"name": "bad", "content": INVALID_YAML_NO_STAGES}
)
result = create_workflow_tool({"name": "bad", "content": INVALID_YAML_NO_STAGES})
assert "invalid" in _text(result).lower() or "stages" in _text(result).lower()
def test_create_missing_name(self):
@@ -196,6 +197,7 @@ class TestCreateWorkflowTool:
# update_workflow_tool
# ─────────────────────────────────────────────────────────────────────────────
class TestUpdateWorkflowTool:
def test_update_user_workflow(self, tmp_user_dir):
from skill_seekers.mcp.tools.workflow_tools import update_workflow_tool
@@ -203,9 +205,7 @@ class TestUpdateWorkflowTool:
(tmp_user_dir / "my-wf.yaml").write_text("old content", encoding="utf-8")
with _mock_bundled_names([]):
result = update_workflow_tool(
{"name": "my-wf", "content": MINIMAL_YAML}
)
result = update_workflow_tool({"name": "my-wf", "content": MINIMAL_YAML})
text = _text(result)
assert "Updated" in text or "updated" in text.lower()
@@ -215,9 +215,7 @@ class TestUpdateWorkflowTool:
from skill_seekers.mcp.tools.workflow_tools import update_workflow_tool
with _mock_bundled_names(["default"]):
result = update_workflow_tool(
{"name": "default", "content": MINIMAL_YAML}
)
result = update_workflow_tool({"name": "default", "content": MINIMAL_YAML})
assert "bundled" in _text(result).lower()
@@ -227,9 +225,7 @@ class TestUpdateWorkflowTool:
(tmp_user_dir / "my-wf.yaml").write_text(MINIMAL_YAML, encoding="utf-8")
with _mock_bundled_names([]):
result = update_workflow_tool(
{"name": "my-wf", "content": INVALID_YAML_NO_STAGES}
)
result = update_workflow_tool({"name": "my-wf", "content": INVALID_YAML_NO_STAGES})
assert "invalid" in _text(result).lower() or "stages" in _text(result).lower()
@@ -240,9 +236,7 @@ class TestUpdateWorkflowTool:
(tmp_user_dir / "default.yaml").write_text("old", encoding="utf-8")
with _mock_bundled_names(["default"]):
result = update_workflow_tool(
{"name": "default", "content": MINIMAL_YAML}
)
result = update_workflow_tool({"name": "default", "content": MINIMAL_YAML})
text = _text(result)
# User has a file named 'default', so it should succeed
@@ -253,6 +247,7 @@ class TestUpdateWorkflowTool:
# delete_workflow_tool
# ─────────────────────────────────────────────────────────────────────────────
class TestDeleteWorkflowTool:
def test_delete_user_workflow(self, tmp_user_dir):
from skill_seekers.mcp.tools.workflow_tools import delete_workflow_tool

View File

@@ -80,6 +80,7 @@ def sample_yaml_file(tmp_path):
# Helpers
# ─────────────────────────────────────────────────────────────────────────────
def _mock_bundled(names=("default", "minimal", "security-focus")):
"""Patch list_bundled_workflows on the captured module object."""
return patch.object(_wf_cmd, "list_bundled_workflows", return_value=list(names))
@@ -87,8 +88,10 @@ def _mock_bundled(names=("default", "minimal", "security-focus")):
def _mock_bundled_text(name_to_text: dict):
"""Patch _bundled_yaml_text on the captured module object."""
def _bundled_yaml_text(name):
return name_to_text.get(name)
return patch.object(_wf_cmd, "_bundled_yaml_text", side_effect=_bundled_yaml_text)
@@ -96,6 +99,7 @@ def _mock_bundled_text(name_to_text: dict):
# cmd_list
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdList:
def test_shows_bundled_and_user(self, capsys, tmp_user_dir):
(tmp_user_dir / "my-workflow.yaml").write_text(MINIMAL_YAML, encoding="utf-8")
@@ -131,6 +135,7 @@ class TestCmdList:
# cmd_show
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdShow:
def test_show_bundled(self, capsys):
with patch.object(_wf_cmd, "_workflow_yaml_text", return_value=MINIMAL_YAML):
@@ -155,6 +160,7 @@ class TestCmdShow:
# cmd_copy
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdCopy:
def test_copy_bundled_to_user_dir(self, capsys, tmp_user_dir):
with _mock_bundled_text({"security-focus": MINIMAL_YAML}):
@@ -206,6 +212,7 @@ class TestCmdCopy:
# cmd_add
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdAdd:
def test_add_valid_yaml(self, capsys, tmp_user_dir, sample_yaml_file):
rc = cmd_add([str(sample_yaml_file)])
@@ -287,6 +294,7 @@ class TestCmdAdd:
# cmd_remove
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdRemove:
def test_remove_user_workflow(self, capsys, tmp_user_dir):
wf = tmp_user_dir / "my-wf.yaml"
@@ -349,6 +357,7 @@ class TestCmdRemove:
# cmd_validate
# ─────────────────────────────────────────────────────────────────────────────
class TestCmdValidate:
def test_validate_bundled_by_name(self, capsys):
with patch.object(_wf_cmd, "WorkflowEngine") as mock_engine_cls:
@@ -388,6 +397,7 @@ class TestCmdValidate:
# main() entry point
# ─────────────────────────────────────────────────────────────────────────────
class TestMain:
def test_main_no_action_exits_0(self):
from skill_seekers.cli.workflows_command import main
@@ -419,7 +429,10 @@ class TestMain:
assert "name: test-workflow" in capsys.readouterr().out
def test_main_show_not_found_exits_1(self, capsys, tmp_user_dir):
with patch.object(_wf_cmd, "_workflow_yaml_text", return_value=None), pytest.raises(SystemExit) as exc:
with (
patch.object(_wf_cmd, "_workflow_yaml_text", return_value=None),
pytest.raises(SystemExit) as exc,
):
_wf_cmd.main(["show", "ghost"])
assert exc.value.code == 1
@@ -505,12 +518,14 @@ class TestMain:
# Parser argument binding
# ─────────────────────────────────────────────────────────────────────────────
class TestWorkflowsParserArgumentBinding:
"""Verify nargs='+' parsers produce lists with correct attribute names."""
def _parse(self, argv):
"""Parse argv through the standalone main() parser by capturing args."""
import argparse
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest="action")