Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ markdown-it = "markdown_it.cli.parse:main"
name = "markdown_it"

[tool.flit.sdist]
include = [
"tests/",
"tox.ini",
]
exclude = [
"docs/",
"tests/",
"benchmarking/"
]

Expand Down
25 changes: 25 additions & 0 deletions tests/test_packaging/test_sdist_includes_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""Regression for https://github.com/executablebooks/markdown-it-py/issues/261."""

from __future__ import annotations

from pathlib import Path


def test_flit_sdist_includes_tests_directory() -> None:
"""sdist must ship tests/ (and tox.ini) so downstream packagers can run them."""
text = (Path(__file__).resolve().parents[2] / "pyproject.toml").read_text(
encoding="utf-8"
)
# Locate the flit sdist table without requiring tomllib (3.10 CI).
start = text.index("[tool.flit.sdist]")
rest = text[start + len("[tool.flit.sdist]") :]
end = rest.find("\n[")
block = rest if end < 0 else rest[:end]
assert "include = [" in block
assert '"tests/"' in block
assert '"tox.ini"' in block
# Still exclude heavy non-test trees.
assert '"docs/"' in block
assert '"benchmarking/"' in block
# Must not exclude tests anymore.
assert '"tests/"' not in block.split("exclude", 1)[-1]