Coverage for tests/test_xpass_friends.py: 100%

1"""This test needs `download-more-tests.sh`.

2

3 This is useful to avoid a sphinx-lint release to break many CIs.

4"""

5

6 import shlex

7 from pathlib import Path

8

9 import pytest

10

11 from sphinxlint.cli import main

12

13 FIXTURE_DIR = Path(__file__).resolve().parent / "fixtures"

14

15

16@pytest.mark.parametrize(

17 "file",

18 [str(f) for f in (FIXTURE_DIR / "friends").iterdir() if f.name != ".DS_Store"]

19 if (FIXTURE_DIR / "friends").is_dir()

20 else [],

21)

22 def test_sphinxlint_friend_projects_shall_pass(file, capsys):

23 flags = (Path(file) / "flags").read_text(encoding="UTF-8")

24 has_errors = main(["sphinxlint.py", file] + shlex.split(flags))

25 out, err = capsys.readouterr()

26 assert err == ""

27 assert out == "No problems found.\n"

28 assert not has_errors