chore: extend .gitignore + add missing integration test

- .gitignore: add .DS_Store, *.log, *.bak, sailo-claude-backup/, .aw/, *.db,
  pytest_cache, test artifacts
- tests/test_md2doc_integration.py: missed in Task 8 commit
This commit is contained in:
2026-07-28 11:05:14 +03:00
parent e8b105a5fb
commit 7b51283ae1
2 changed files with 88 additions and 1 deletions
+28 -1
View File
@@ -1,3 +1,30 @@
.venv/ # Python
__pycache__/ __pycache__/
*.pyc *.pyc
*.pyo
.pytest_cache/
*.egg-info/
.venv/
venv/
# macOS
.DS_Store
# Logs
*.log
firebase-debug.log
# Backups
*.bak
sailo-claude-backup/
# AW local state (PostgreSQL is source of truth)
.aw/
# Local databases
vectors.db
*.db
# Generated test artifacts
tests/_tmp_*.docx
tests/_tmp_*.pdf
+60
View File
@@ -0,0 +1,60 @@
"""Integration test — full md → docx conversion on pluxee-todo.md fixture."""
import subprocess
import sys
import zipfile
import xml.etree.ElementTree as ET
from pathlib import Path
REPO = Path(__file__).parent.parent
FIXTURE = REPO / "pluxee-todo.md"
W_NS = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
def test_convert_pluxee_todo_creates_valid_docx(tmp_path):
out = tmp_path / "pluxee.docx"
r = subprocess.run(
[sys.executable, "md2doc.py", str(FIXTURE), "-o", str(out)],
cwd=REPO, capture_output=True, text=True
)
assert r.returncode == 0, f"Conversion failed: {r.stderr}"
assert out.exists()
assert out.stat().st_size > 0
def test_converted_docx_has_headings_and_paragraphs(tmp_path):
out = tmp_path / "pluxee.docx"
subprocess.run(
[sys.executable, "md2doc.py", str(FIXTURE), "-o", str(out), "-q"],
cwd=REPO, capture_output=True, text=True
)
with zipfile.ZipFile(out) as z:
root = ET.fromstring(z.read("word/document.xml"))
headings = list(root.iter(f"{{{W_NS}}}pStyle"))
heading_vals = [h.get(f"{{{W_NS}}}val") for h in headings]
assert any(v and v.startswith("Heading") for v in heading_vals), \
f"expected at least one Heading style, got {heading_vals}"
def test_image_in_markdown_warns_to_stderr(tmp_path):
md_with_image = tmp_path / "img.md"
md_with_image.write_text("# Test\n\n![alt text](https://example.com/x.png)\n")
out = tmp_path / "img.docx"
r = subprocess.run(
[sys.executable, "md2doc.py", str(md_with_image), "-o", str(out)],
cwd=REPO, capture_output=True, text=True
)
assert r.returncode == 0 # warning, not error
assert "image" in r.stderr.lower() or "skip" in r.stderr.lower()
def test_directory_mode_converts_all_md(tmp_path):
(tmp_path / "a.md").write_text("# A\n")
(tmp_path / "b.md").write_text("# B\n")
out_dir = tmp_path / "out"
r = subprocess.run(
[sys.executable, "md2doc.py", str(tmp_path), "-o", str(out_dir)],
cwd=REPO, capture_output=True, text=True
)
assert r.returncode == 0
assert (out_dir / "a.docx").exists()
assert (out_dir / "b.docx").exists()