fix(seedgo): resolve ruff lint errors in test files

- Remove sys.path.insert() blocks from test files (E402) — package is
  installed via pip install -e . so path manipulation is unnecessary
- Move import importlib.util and import subprocess to top of file (E402)
- Remove unused sys import from test_seedgo_core.py (F401)
- Fix undefined _src_path reference in test_seedgo_cli.py (F821)
- Remove unused result variable assignment in TestCLIInit (F841)
- Remove extraneous f prefix from f-string in cli.py (F541)

All 249 tests pass. Zero ruff violations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
AIOSAI
2026-03-01 20:25:28 -08:00
co-authored by Claude Opus 4.6
parent ba51e747cf
commit a295e18b03
4 changed files with 5 additions and 28 deletions
+1 -1
View File
@@ -159,7 +159,7 @@ def _cmd_init(args: argparse.Namespace) -> None:
try:
config_path = create_default_config(project_root, profile=profile)
print(f"Seed Go initialized.")
print("Seed Go initialized.")
print(f" Config: {config_path}")
print(f" Plugins: {str(Path(config_path).parent / 'plugins')}")
if profile:
+3 -12
View File
@@ -14,19 +14,12 @@ sys.path fix ensures src/ is importable when running from the repo root:
"""
import json
import subprocess
import sys
from pathlib import Path
import pytest
# ---------------------------------------------------------------------------
# sys.path fix — must appear before any seedgo imports
# ---------------------------------------------------------------------------
_src_path = str(Path(__file__).parent.parent / "src")
if _src_path not in sys.path:
sys.path.insert(0, _src_path)
from seedgo.models import CheckItem, CheckResult, Severity
from seedgo.runner import (
_file_matches_types,
@@ -791,18 +784,16 @@ class TestReportGitHub:
# ---------------------------------------------------------------------------
import subprocess
class TestCLIInit:
def test_init_creates_config_file(self, tmp_path):
result = subprocess.run(
subprocess.run(
[sys.executable, "-m", "seedgo.cli"],
input="",
capture_output=True,
text=True,
cwd=str(tmp_path),
env={**__import__("os").environ, "PYTHONPATH": _src_path},
env={**__import__("os").environ, "PYTHONPATH": str(Path(__file__).parent.parent / "src")},
)
# The above runs cli as module — we need the main() entry
# Actually test by calling main() directly via runner script
-7
View File
@@ -12,17 +12,10 @@ Target: 85%+ coverage of src/seedgo/ core modules.
"""
import json
import sys
from pathlib import Path
import pytest
# Ensure src/ is on the path when running from the repo root
_repo_root = Path(__file__).parent.parent
_src_path = str(_repo_root / "src")
if _src_path not in sys.path:
sys.path.insert(0, _src_path)
from seedgo.models import CheckItem, CheckResult, Severity
from seedgo.config import (
DEFAULT_CONFIG,
+1 -8
View File
@@ -17,19 +17,12 @@ Each plugin has:
Uses tmp_path for isolated test directories.
"""
import sys
import importlib.util
from pathlib import Path
import pytest
# Ensure src/ is on the path when running from the repo root
_repo_root = Path(__file__).parent.parent
_src_path = str(_repo_root / "src")
if _src_path not in sys.path:
sys.path.insert(0, _src_path)
# Import plugin modules directly for unit testing
import importlib.util
def _load_plugin(plugin_filename: str | Path):
"""Load a plugin module by filename from the plugins directory."""