fix(ci): restore green backend CI — ruff config + unused import cleanup #117
47 changed files with 18 additions and 84 deletions
|
|
@ -12,7 +12,7 @@ import pytest
|
|||
from dotenv import load_dotenv
|
||||
from playwright.sync_api import Page, BrowserContext
|
||||
|
||||
from tests.e2e.models import ErrorRecord, ModeConfig, diff_errors
|
||||
from tests.e2e.models import ErrorRecord, ModeConfig
|
||||
from tests.e2e.modes.demo import DEMO
|
||||
from tests.e2e.modes.cloud import CLOUD
|
||||
from tests.e2e.modes.local import LOCAL
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ from __future__ import annotations
|
|||
import pytest
|
||||
|
||||
from tests.e2e.conftest import (
|
||||
wait_for_streamlit, get_page_errors, screenshot_on_fail,
|
||||
wait_for_streamlit, screenshot_on_fail,
|
||||
)
|
||||
from tests.e2e.models import ModeConfig, diff_errors
|
||||
from tests.e2e.models import diff_errors
|
||||
from tests.e2e.pages.home_page import HomePage
|
||||
from tests.e2e.pages.job_review_page import JobReviewPage
|
||||
from tests.e2e.pages.apply_page import ApplyPage
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ Run: pytest tests/e2e/test_smoke.py --mode=demo
|
|||
from __future__ import annotations
|
||||
import pytest
|
||||
|
||||
from tests.e2e.conftest import wait_for_streamlit, get_page_errors, get_console_errors, screenshot_on_fail
|
||||
from tests.e2e.models import ModeConfig
|
||||
from tests.e2e.conftest import wait_for_streamlit, screenshot_on_fail
|
||||
from tests.e2e.pages.home_page import HomePage
|
||||
from tests.e2e.pages.job_review_page import JobReviewPage
|
||||
from tests.e2e.pages.apply_page import ApplyPage
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from pathlib import Path
|
||||
import yaml
|
||||
from scripts.user_profile import UserProfile
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
"""Tests for scripts/backup.py — create, list, restore, and multi-instance support."""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
from scripts.backup import (
|
||||
_decrypt_db_to_bytes,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""Tests for BYOK cloud backend detection."""
|
||||
import pytest
|
||||
from scripts.byok_guard import is_cloud_backend, cloud_backends
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ from datetime import timezone
|
|||
from pathlib import Path
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import os
|
||||
from unittest.mock import patch, MagicMock
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
def test_resolve_session_is_noop_in_local_mode(monkeypatch):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
# tests/test_cover_letter.py
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
|
|
@ -90,7 +88,7 @@ def test_find_similar_letters_returns_top_k():
|
|||
|
||||
def test_load_corpus_returns_list():
|
||||
"""load_corpus returns a list (empty if LETTERS_DIR absent) without crashing."""
|
||||
from scripts.generate_cover_letter import load_corpus, LETTERS_DIR
|
||||
from scripts.generate_cover_letter import load_corpus
|
||||
|
||||
corpus = load_corpus()
|
||||
assert isinstance(corpus, list)
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ class TestTaskRunnerCoverLetterParams:
|
|||
patch("sqlite3.connect") as mock_conn, \
|
||||
patch("scripts.task_runner.generate_cover_letter_fn", mock_generate, create=True):
|
||||
|
||||
import sqlite3
|
||||
mock_row = MagicMock()
|
||||
mock_row.__iter__ = lambda s: iter(job.items())
|
||||
mock_row.keys = lambda: job.keys()
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ from email.utils import format_datetime
|
|||
from unittest.mock import patch, MagicMock
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
import pytest
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
def test_init_db_creates_jobs_table(tmp_path):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for scripts/db_migrate.py — numbered SQL migration runner."""
|
||||
|
||||
import sqlite3
|
||||
import textwrap
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""Tests for resume library db helpers."""
|
||||
import sqlite3
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"""IS_DEMO write-block guard tests."""
|
||||
import importlib
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
import pytest
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"""Tests for app/components/demo_toolbar.py."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
"""Tests for digest queue API endpoints."""
|
||||
import sqlite3
|
||||
import os
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""Tests for new dev-api.py endpoints: stage signals, email sync, signal dismiss."""
|
||||
import sqlite3
|
||||
import tempfile
|
||||
import os
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""Tests for interview prep endpoints: research GET/generate/task, contacts GET."""
|
||||
import json
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from fastapi.testclient import TestClient
|
||||
|
|
@ -17,7 +16,6 @@ def client():
|
|||
|
||||
def test_get_research_found(client):
|
||||
"""Returns research row (minus raw_output) when present."""
|
||||
import sqlite3
|
||||
mock_row = {
|
||||
"job_id": 1,
|
||||
"company_brief": "Acme Corp makes anvils.",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
"""Tests for all settings API endpoints added in Tasks 1–8."""
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
# credential_store.py was merged to main repo — no worktree path manipulation needed
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import sys
|
||||
from pathlib import Path
|
||||
import yaml
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# tests/test_discover.py
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
import pandas as pd
|
||||
from pathlib import Path
|
||||
|
||||
SAMPLE_JOB = {
|
||||
"title": "Customer Success Manager",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""Unit tests for E2E harness models and helper utilities."""
|
||||
import fnmatch
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
import time
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""Tests for the feedback API backend."""
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# ── mask_pii ──────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
"""Tests for imap_sync helpers (no live IMAP connection required)."""
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
|
|
@ -510,7 +509,7 @@ def test_search_folder_special_gmail_name():
|
|||
def test_get_existing_message_ids_excludes_null(tmp_path):
|
||||
"""NULL message_id rows are excluded from the returned set."""
|
||||
import sqlite3
|
||||
from scripts.db import init_db, insert_job, add_contact
|
||||
from scripts.db import init_db, insert_job
|
||||
from scripts.imap_sync import _get_existing_message_ids
|
||||
|
||||
db_path = tmp_path / "test.db"
|
||||
|
|
@ -980,7 +979,6 @@ def test_scan_todo_label_stage_signal_set_for_non_neutral(tmp_path):
|
|||
|
||||
def test_scan_todo_label_body_fallback_matches(tmp_path):
|
||||
"""Company name only in body[:300] still triggers a match (body fallback)."""
|
||||
from scripts.db import get_contacts
|
||||
from scripts.imap_sync import _scan_todo_label
|
||||
|
||||
db_path = tmp_path / "test.db"
|
||||
|
|
@ -1110,7 +1108,6 @@ def test_parse_message_large_body_not_truncated():
|
|||
def test_parse_message_binary_attachment_no_crash():
|
||||
"""Email with binary attachment returns a valid dict without crashing."""
|
||||
from scripts.imap_sync import _parse_message
|
||||
import email as _email
|
||||
from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.application import MIMEApplication
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ def test_fields_returns_list_of_dicts():
|
|||
def test_save_and_load_config(tmp_path):
|
||||
"""save_config writes yaml; load_config reads it back."""
|
||||
from scripts.integrations.base import IntegrationBase
|
||||
import yaml
|
||||
|
||||
class TestIntegration(IntegrationBase):
|
||||
name = "savetest"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import json
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
import jwt as pyjwt
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
import json
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from unittest.mock import patch
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives import serialization
|
||||
import jwt as pyjwt
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
from pathlib import Path
|
||||
import yaml
|
||||
from scripts.user_profile import UserProfile
|
||||
from scripts.generate_llm_config import apply_service_urls
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ def test_complete_without_images_skips_vision_service(tmp_path):
|
|||
"""When images=None, vision_service backend is skipped."""
|
||||
import yaml
|
||||
from scripts.llm_router import LLMRouter
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
|
||||
cfg = {
|
||||
"fallback_order": ["vision_service"],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Tests for Peregrine's LLMRouter shim — priority fallback logic."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, MagicMock, call
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
|
@ -54,7 +54,6 @@ def test_uses_local_yaml_when_present():
|
|||
|
||||
def test_falls_through_to_env_when_no_yamls():
|
||||
"""When no yaml files exist, super().__init__ is called with no args (env-var path)."""
|
||||
import scripts.llm_router as shim_mod
|
||||
from circuitforge_core.llm import LLMRouter as _CoreLLMRouter
|
||||
|
||||
captured = {}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
"""Integration tests for messaging endpoints."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import sys
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
"""Tests for scripts/preflight.py additions: dual-GPU service table, size warning, VRAM check."""
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
import yaml
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
|
||||
# ── Service table ──────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
"""Tests: preflight writes OLLAMA_HOST to .env when Ollama is adopted from host."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch, call
|
||||
from unittest.mock import patch
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@
|
|||
Set CF_RERANKER_MOCK=1 to avoid loading real model weights during tests.
|
||||
"""
|
||||
import os
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
os.environ["CF_RERANKER_MOCK"] = "1"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
# tests/test_resume_optimizer.py
|
||||
"""Tests for scripts/resume_optimizer.py"""
|
||||
import json
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
# ── Fixtures ─────────────────────────────────────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
"""Unit tests for scripts.resume_sync — format transform between library and profile."""
|
||||
import json
|
||||
import pytest
|
||||
from scripts.resume_sync import (
|
||||
library_to_profile_content,
|
||||
profile_to_library,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
"""Integration tests for resume library<->profile sync endpoints."""
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
"""Tests for /api/resumes/* endpoints."""
|
||||
import json
|
||||
import io
|
||||
import sqlite3
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
# tests/test_sync.py
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
SAMPLE_FM = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import threading
|
||||
import time
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
import sqlite3
|
||||
|
||||
|
|
@ -178,7 +176,6 @@ def test_submit_task_actually_completes(tmp_path):
|
|||
def test_run_task_enrich_craigslist_success(tmp_path):
|
||||
"""enrich_craigslist task calls enrich_craigslist_fields and marks completed."""
|
||||
from scripts.db import init_db, insert_job, insert_task, get_task_for_job
|
||||
from unittest.mock import MagicMock
|
||||
db = tmp_path / "test.db"
|
||||
init_db(db)
|
||||
job_id = insert_job(db, {
|
||||
|
|
@ -200,7 +197,7 @@ def test_run_task_enrich_craigslist_success(tmp_path):
|
|||
|
||||
def test_scrape_url_submits_enrich_craigslist_for_craigslist_job(tmp_path):
|
||||
"""After scrape_url completes for a craigslist job with empty company, enrich_craigslist is queued."""
|
||||
from scripts.db import init_db, insert_job, insert_task, get_task_for_job
|
||||
from scripts.db import init_db, insert_job, insert_task
|
||||
db = tmp_path / "test.db"
|
||||
init_db(db)
|
||||
job_id = insert_job(db, {
|
||||
|
|
@ -285,7 +282,7 @@ def test_wizard_generate_null_params_fails(tmp_path):
|
|||
|
||||
def test_wizard_generate_stores_result_as_json(tmp_path):
|
||||
"""wizard_generate stores result JSON in error field on success."""
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
db = tmp_path / "t.db"
|
||||
from scripts.db import init_db, insert_task
|
||||
init_db(db)
|
||||
|
|
@ -311,7 +308,7 @@ def test_wizard_generate_stores_result_as_json(tmp_path):
|
|||
|
||||
def test_wizard_generate_feedback_appended_to_prompt(tmp_path):
|
||||
"""feedback and previous_result fields in input_data are appended to the prompt."""
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
db = tmp_path / "t.db"
|
||||
from scripts.db import init_db, insert_task
|
||||
init_db(db)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
import sqlite3
|
||||
import threading
|
||||
from collections import deque
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -192,7 +191,6 @@ def test_max_queue_depth_logs_warning(tmp_db, caplog):
|
|||
"""Queue depth overflow logs a WARNING."""
|
||||
import logging
|
||||
from scripts.db import insert_task
|
||||
from scripts.task_scheduler import TaskSpec
|
||||
|
||||
s = TaskScheduler(tmp_db, _noop_run_task)
|
||||
s._max_queue_depth = 0 # immediately at limit
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import pytest
|
||||
import os
|
||||
from unittest.mock import patch, MagicMock, call
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
def test_no_op_in_local_mode(monkeypatch):
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# tests/test_user_profile.py
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
import tempfile, yaml
|
||||
import yaml
|
||||
from scripts.user_profile import UserProfile
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||
|
||||
from app.wizard.tiers import can_use, tier_label, TIERS, FEATURES, BYOK_UNLOCKABLE
|
||||
from app.wizard.tiers import can_use, tier_label, TIERS, BYOK_UNLOCKABLE
|
||||
|
||||
|
||||
def test_tiers_list():
|
||||
|
|
|
|||
Loading…
Reference in a new issue