tests: centralize script path setup in conftest.py
Add a pytest-discovered tests/conftest.py for the last30days scripts path and remove duplicate per-file sys.path.insert boilerplate from tests. Normalize affected imports to rely on the shared scripts path and remove the now-unneeded E402 suppressions.
This commit is contained in:
@@ -1,18 +1,12 @@
|
||||
# ruff: noqa: E402
|
||||
"""Tests for scripts/lib/competitors.discover_competitors."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import sys
|
||||
import unittest
|
||||
from contextlib import redirect_stderr
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(REPO_ROOT / "skills" / "last30days" / "scripts"))
|
||||
|
||||
from lib import competitors
|
||||
|
||||
|
||||
@@ -23,7 +17,6 @@ def _serp(items: list[tuple[str, str]]) -> list[dict]:
|
||||
for title, snippet in items
|
||||
]
|
||||
|
||||
|
||||
OPENAI_SERP = _serp(
|
||||
[
|
||||
("OpenAI vs Anthropic vs xAI: which is better?", "xAI and Anthropic now compete directly with OpenAI."),
|
||||
@@ -147,6 +140,5 @@ class CompetitorDiscoveryTests(unittest.TestCase):
|
||||
results = self._run(OPENAI_SERP, "OpenAI", count=0)
|
||||
self.assertEqual(results, [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user