From 8f24addb13d3a39e2eae66ae8834ed1c1872e487 Mon Sep 17 00:00:00 2001 From: Yuzhong Zhang Date: Thu, 3 Sep 2026 21:36:22 +0000 Subject: [PATCH 1/2] fix: include tests/ (and tox.ini) in the flit sdist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #261 — flit_core sdists omitted the test suite while shipping tox.ini, so distro packagers could not run the project's tests from the PyPI source tarball. Explicitly include tests/ and tox.ini; keep docs/ and benchmarking/ excluded. --- pyproject.toml | 5 +++- .../test_sdist_includes_tests.py | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 tests/test_packaging/test_sdist_includes_tests.py diff --git a/pyproject.toml b/pyproject.toml index 34d54fce..533cbb80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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/" ] diff --git a/tests/test_packaging/test_sdist_includes_tests.py b/tests/test_packaging/test_sdist_includes_tests.py new file mode 100644 index 00000000..6d42a883 --- /dev/null +++ b/tests/test_packaging/test_sdist_includes_tests.py @@ -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] From 3f75c9e64082fe1dc2cd16fd221dfe75477c69fa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 21:36:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_packaging/test_sdist_includes_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_packaging/test_sdist_includes_tests.py b/tests/test_packaging/test_sdist_includes_tests.py index 6d42a883..f7687cd8 100644 --- a/tests/test_packaging/test_sdist_includes_tests.py +++ b/tests/test_packaging/test_sdist_includes_tests.py @@ -15,7 +15,7 @@ def test_flit_sdist_includes_tests_directory() -> None: rest = text[start + len("[tool.flit.sdist]") :] end = rest.find("\n[") block = rest if end < 0 else rest[:end] - assert 'include = [' in block + assert "include = [" in block assert '"tests/"' in block assert '"tox.ini"' in block # Still exclude heavy non-test trees.