marki-docx/tests/conftest.py

63 lines
1.3 KiB
Python
Raw Normal View History

"""Shared test fixtures for markidocx tests."""
from __future__ import annotations
import textwrap
from pathlib import Path
import pytest
SIMPLE_MARKDOWN = textwrap.dedent("""\
# Hello World
This is a paragraph with **bold** and *italic* text.
## Section One
- Item one
- Item two
- Item three
### Subsection
Some text with a [link](https://example.com) and `inline code`.
## Section Two
| Column A | Column B | Column C |
|----------|----------|----------|
| row1a | row1b | row1c |
| row2a | row2b | row2c |
1. First ordered item
2. Second ordered item
3. Third ordered item
""")
SIMPLE_MANIFEST_YAML = textwrap.dedent("""\
project:
name: "Test Document"
feature_level: level1
family: article
sources:
- path: doc.md
output:
dir: ./dist
metadata:
title: "Test Document"
author: "Test Author"
date: "2026-01-01"
""")
@pytest.fixture()
def tmp_project(tmp_path: Path) -> Path:
"""Create a minimal project directory with a manifest and source file."""
(tmp_path / "doc.md").write_text(SIMPLE_MARKDOWN, encoding="utf-8")
(tmp_path / "manifest.yaml").write_text(SIMPLE_MANIFEST_YAML, encoding="utf-8")
(tmp_path / "dist").mkdir()
return tmp_path