44 lines
1.9 KiB
Python
44 lines
1.9 KiB
Python
"""OutputManager run-folder naming: the default {run} counter and the new
|
|
configurable folder_format (deterministic sidecars for the doocus meeting flow)."""
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from tests import REPO_ROOT # noqa: F401
|
|
from meetus.output_manager import OutputManager, DEFAULT_FOLDER_FORMAT
|
|
|
|
|
|
class TestFolderFormat(unittest.TestCase):
|
|
def test_default_uses_date_run_stem(self):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
om = OutputManager(Path("/x/meeting.mkv"), d)
|
|
name = om.output_dir.name
|
|
self.assertTrue(name.endswith("-meeting"))
|
|
# YYYYMMDD-NNN-meeting → middle part is the zero-padded run number
|
|
self.assertRegex(name, r"^\d{8}-\d{3}-meeting$")
|
|
|
|
def test_deterministic_sidecar_no_counter(self):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
om = OutputManager(Path("/x/team a/standup.mp4"), d, folder_format="{name}.meetus")
|
|
self.assertEqual(om.output_dir.name, "standup.mp4.meetus")
|
|
|
|
def test_sidecar_reused_by_name(self):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
a = OutputManager(Path("/x/standup.mp4"), d, folder_format="{name}.meetus")
|
|
b = OutputManager(Path("/x/standup.mp4"), d, folder_format="{name}.meetus")
|
|
self.assertEqual(a.output_dir, b.output_dir) # caching by stable name
|
|
|
|
def test_stem_token(self):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
om = OutputManager(Path("/x/standup.mp4"), d, folder_format="{stem}")
|
|
self.assertEqual(om.output_dir.name, "standup")
|
|
|
|
def test_empty_format_falls_back_to_default(self):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
om = OutputManager(Path("/x/m.mkv"), d, folder_format="")
|
|
self.assertEqual(om.folder_format, DEFAULT_FOLDER_FORMAT)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|