mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
AST-driven pass over every Path.read_text()/write_text() without an explicit encoding= across non-test code: 71 sites in 34 files (skills_hub, hermes_cli/main+profiles+service_manager+container_boot, mem0/hindsight/honcho plugins, achievements dashboard, release/CI scripts, productivity+comfyui skill helpers, agent/*). Verified zero positional-encoding collisions before insertion; per-file compile() check after. Adds a check-windows-footguns rule flagging bare single-line read_text/write_text (multi-line forms stay covered by the AST guard test from #38985). Together with the salvaged contributor commits this retires the ~169-site bare file-I/O class (#37423's long tail).
64 lines
1.5 KiB
Python
64 lines
1.5 KiB
Python
"""Pytest configuration for the comfyui skill test suite.
|
|
|
|
Adds `scripts/` to sys.path so tests can `from _common import ...`, and
|
|
provides a few common fixtures.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
SCRIPTS = ROOT / "scripts"
|
|
WORKFLOWS = ROOT / "workflows"
|
|
|
|
sys.path.insert(0, str(SCRIPTS))
|
|
|
|
|
|
@pytest.fixture
|
|
def sd15_workflow() -> dict:
|
|
return json.loads((WORKFLOWS / "sd15_txt2img.json").read_text(encoding="utf-8"))
|
|
|
|
|
|
@pytest.fixture
|
|
def flux_workflow() -> dict:
|
|
return json.loads((WORKFLOWS / "flux_dev_txt2img.json").read_text(encoding="utf-8"))
|
|
|
|
|
|
@pytest.fixture
|
|
def video_workflow() -> dict:
|
|
return json.loads((WORKFLOWS / "wan_video_t2v.json").read_text(encoding="utf-8"))
|
|
|
|
|
|
@pytest.fixture
|
|
def workflows_dir() -> Path:
|
|
return WORKFLOWS
|
|
|
|
|
|
@pytest.fixture
|
|
def scripts_dir() -> Path:
|
|
return SCRIPTS
|
|
|
|
|
|
@pytest.fixture
|
|
def cloud_key() -> str | None:
|
|
"""Cloud API key if set, otherwise None.
|
|
|
|
Tests that need cloud connectivity should skip when this is None.
|
|
"""
|
|
return os.environ.get("COMFY_CLOUD_API_KEY")
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
"""Auto-skip cloud tests when no API key is set."""
|
|
if os.environ.get("COMFY_CLOUD_API_KEY"):
|
|
return
|
|
skip_cloud = pytest.mark.skip(reason="Set COMFY_CLOUD_API_KEY to run cloud tests")
|
|
for item in items:
|
|
if "cloud" in item.keywords:
|
|
item.add_marker(skip_cloud)
|