mirror of
https://github.com/umbra2728/ctfd-mcp.git
synced 2026-02-07 22:08:12 +03:00
package: move code into src layout and add PyPI publish workflow
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
"""Config loading tests (ruff: ignore E402 for sys.path adjustment)."""
|
||||
|
||||
# ruff: noqa: E402
|
||||
|
||||
import os
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from config import load_config
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
SRC = ROOT / "src"
|
||||
for path in (SRC, ROOT):
|
||||
if str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
|
||||
from ctfd_mcp.config import load_config
|
||||
|
||||
|
||||
def _load_with_env(env: dict[str, str]):
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
"""CTFd client tests (ruff: ignore E402 for sys.path adjustment)."""
|
||||
|
||||
# ruff: noqa: E402
|
||||
|
||||
import asyncio
|
||||
import json
|
||||
import os
|
||||
@@ -9,19 +13,17 @@ from pathlib import Path
|
||||
import httpx
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
SRC = ROOT / "src"
|
||||
for path in (SRC, ROOT):
|
||||
if str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
|
||||
# Avoid optional dependency issues in the test runner (python-dotenv).
|
||||
if "dotenv" not in sys.modules:
|
||||
sys.modules["dotenv"] = types.SimpleNamespace(load_dotenv=lambda *_, **__: None)
|
||||
|
||||
from config import Config # type: ignore # noqa: E402 # added to path above
|
||||
from ctfd_client import ( # type: ignore # noqa: E402
|
||||
AuthError,
|
||||
CTFdClient,
|
||||
CTFdClientError,
|
||||
)
|
||||
from ctfd_mcp.config import Config # type: ignore
|
||||
from ctfd_mcp.ctfd_client import AuthError, CTFdClient, CTFdClientError # type: ignore
|
||||
|
||||
CTFD_URL = os.getenv("CTFD_URL")
|
||||
CTFD_USERNAME = os.getenv("CTFD_USERNAME")
|
||||
|
||||
Reference in New Issue
Block a user