def file_factory(tmp_path: Path):
    """Fixture to create a file in pytest tmpdir."""

    def create_file(filename: str, content: str) -> str:
        filepath = tmp_path / filename
        with open(filepath, "w", encoding="utf-8") as f:
            f.write(dedent(content))
        return str(filepath.absolute())

    return create_file
Fixture to create a file in pytest tmpdir.
tests/test_loaders.py