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:
@@ -2,16 +2,12 @@ import json
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import textwrap
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "skills" / "last30days" / "scripts"))
|
||||
|
||||
from lib.bird_x import parse_bird_response
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
VENDORED_BIRD = REPO_ROOT / "skills" / "last30days" / "scripts" / "lib" / "vendor" / "bird-search" / "bird-search.mjs"
|
||||
|
||||
@@ -31,7 +27,6 @@ class TestBirdXEngagementZero(unittest.TestCase):
|
||||
self.assertEqual(0, items[0]["engagement"]["likes"])
|
||||
self.assertEqual(5, items[0]["engagement"]["reposts"])
|
||||
|
||||
|
||||
@unittest.skipUnless(shutil.which("node"), "node is required for vendored Bird tests")
|
||||
class TestVendoredBirdRuntime(unittest.TestCase):
|
||||
def test_check_uses_env_credentials_without_browser_cookie_dependency(self):
|
||||
@@ -305,6 +300,5 @@ class TestRunBirdSearchJsonDecodeRetry(unittest.TestCase):
|
||||
self.assertEqual(response, timeout_error)
|
||||
mock_sleep.assert_not_called()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user