from __future__ import annotations import tomllib from pathlib import Path PROJECT_ROOT = Path(__file__).resolve().parents[1] BUSINESS_MODULES = ( "content_marketing", "product_commerce", "shop_intelligence", "supply_chain", ) def test_repository_keeps_the_simplified_public_structure() -> None: modules_root = PROJECT_ROOT / "src" / "gyxx_flow" / "modules" for module in BUSINESS_MODULES: module_root = modules_root / module compatibility_items = { path.name for path in (module_root / "runtime").iterdir() if path.name != "__pycache__" } assert compatibility_items == {"__init__.py"} assert not (module_root / "tests").exists() assert not (module_root / "runtime_tests").exists() primary_docs = { path.name for path in (PROJECT_ROOT / "docs").iterdir() if path.is_file() } assert primary_docs == { "acceptance-report.md", "architecture.md", "deployment.md", "plan.md", "runbook.md", "workflow-acceptance-test-report.md", "workflow-acceptance-test-requirements.md", "workflow-console.md", } assert not { "design.md", "final_report.md", "plan.md", "review.md", } & {path.name for path in PROJECT_ROOT.iterdir() if path.is_file()} def test_development_group_contains_reproducible_quality_tools() -> None: configuration = tomllib.loads( (PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8") ) development = configuration["dependency-groups"]["dev"] package_names = {requirement.split(">=", 1)[0] for requirement in development} assert {"build", "pytest", "ruff"} <= package_names assert ( "src/gyxx_flow/modules/*/**" in configuration["tool"]["ruff"]["extend-exclude"] ) assert configuration["tool"]["pytest"]["ini_options"]["testpaths"] == ["tests"] def test_gitlab_ci_runs_lock_lint_tests_and_build() -> None: pipeline = (PROJECT_ROOT / ".gitlab-ci.yml").read_text(encoding="utf-8") assert "uv sync --frozen --group dev" in pipeline assert "uv run ruff check src tests" in pipeline assert "uv run ruff check src/gyxx_flow/modules/content_marketing/daily_creator_exposure_scope.py" in pipeline assert "src/gyxx_flow/modules/product_commerce/market_rank_product_import.py" in pipeline assert "uv run pytest" in pipeline assert "test_daily_creator_exposure_scope.py" in pipeline assert "test_chanmama_refresh_before_export.py" in pipeline assert "test_daily_exposure_fields.py" in pipeline assert "test_market_rank_limits.py" in pipeline assert "test_market_rank_product_import.py" in pipeline assert "uv build" in pipeline