diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..2436fa2 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "video-pipeline.wiki"] + path = video-pipeline.wiki + url = https://github.com/LCS-Gramps/video-pipeline.wiki.git diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..0759482 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,20 @@ +# tests/conftest.py +""" +Shared pytest fixtures and constants for testing the LCS video pipeline. +""" + +import pytest +from pathlib import Path + +@pytest.fixture(scope="session") +def test_session_path() -> Path: + """ + Fixture providing the fixed test session directory. + + NOTE: This directory must exist and be preserved. It contains test clips + and notes.json used by multiple tests. + + Returns: + Path: Absolute path to test session folder. + """ + return Path("Z:/LCS/Videos/eklipse/2025.07.25.9") diff --git a/tests/sync_wiki.py b/tests/sync_wiki.py new file mode 100644 index 0000000..7c8eeee --- /dev/null +++ b/tests/sync_wiki.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +""" +sync_wiki.py + +Synchronizes local markdown files in docs/wiki/ to the GitHub wiki +for the Llama Chile Shop video pipeline project. + +Requires the GitHub wiki repo to be cloned into ./video-pipeline.wiki/. + +Author: gramps@llamachile.shop +""" + +import os +import shutil +import subprocess +from pathlib import Path +print("🧠 THIS IS THE CORRECT sync_wiki.py") + +# Correct paths for wiki sync +LOCAL_WIKI_SOURCE = Path("docs/wiki") +LOCAL_WIKI_REPO = Path("video-pipeline.wiki") +print("🔍 Executing: sync_wiki.py from", __file__) + +def sync_wiki(): + if not LOCAL_WIKI_REPO.exists(): + print("❌ Wiki repo not found. Clone it using:") + print(" git clone https://github.com/LCS-Gramps/video-pipeline.wiki.git") + return + + # Copy .md files to the local wiki repo + for md_file in LOCAL_WIKI_SOURCE.glob("*.md"): + target = LOCAL_WIKI_REPO / md_file.name + shutil.copy2(md_file, target) + print(f"✅ Synced: {md_file.name}") + + # Commit and push changes + os.chdir(LOCAL_WIKI_REPO) + subprocess.run(["git", "add", "."], check=True) + subprocess.run(["git", "commit", "-m", "📚 Sync updated wiki pages from docs/wiki"], check=True) + subprocess.run(["git", "push"], check=True) + print("🚀 Wiki updated successfully.") + +if __name__ == "__main__": + sync_wiki() diff --git a/tests/test_full_pipeline.py b/tests/test_full_pipeline.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_metadata_utils.py b/tests/test_metadata_utils.py new file mode 100644 index 0000000..ba35706 --- /dev/null +++ b/tests/test_metadata_utils.py @@ -0,0 +1,52 @@ +# tests/test_metadata_utils.py +""" +Unit tests for metadata parsing and archiving functions. +""" + +from modules.metadata_utils import derive_session_metadata, save_metadata_record +from pathlib import Path +import json + + +def test_derive_session_metadata_structure(test_session_path): + """ + Validates that metadata is parsed correctly and includes expected keys. + """ + metadata = derive_session_metadata(test_session_path) + + assert "session_date" in metadata + assert "clips" in metadata + assert isinstance(metadata["clips"], list) + assert len(metadata["clips"]) > 0, "Expected at least one clip in metadata" + + for clip in metadata["clips"]: + assert "stem" in clip + assert "highlight" in clip or "notes" in clip + assert clip["format"] in ("wide", "vertical") + + +def test_save_metadata_record_creates_file(tmp_path): + """ + Ensures metadata is saved to a properly named JSON file. + """ + fake_record = { + "session_date": "2025-07-25", + "stem": "test-clip", + "youtube_urls": ["https://youtu.be/test123"], + "peertube_urls": [], + } + + # Override history dir to a temp path + from modules import metadata_utils + metadata_utils.HISTORY_DIR = tmp_path + + save_metadata_record(fake_record) + + expected_dir = tmp_path / "2025.07.25" + expected_file = expected_dir / "test-clip.json" + + assert expected_file.exists(), f"Expected {expected_file} to be created" + + with expected_file.open("r", encoding="utf-8") as f: + data = json.load(f) + assert data["youtube_urls"][0] == "https://youtu.be/test123" diff --git a/tests/test_title_utils.py b/tests/test_title_utils.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_yt_poster.py b/tests/test_yt_poster.py new file mode 100644 index 0000000..e69de29 diff --git a/video-pipeline.wiki b/video-pipeline.wiki new file mode 160000 index 0000000..1ec269c --- /dev/null +++ b/video-pipeline.wiki @@ -0,0 +1 @@ +Subproject commit 1ec269c8efc820eed1964475c59e7f671d834520