2022-07-28 18:58:03 +00:00
|
|
|
"""Djlint tests specific to .djlintrc configuration.
|
|
|
|
|
|
|
|
|
|
run::
|
|
|
|
|
|
2022-09-07 16:15:21 +00:00
|
|
|
pytest tests/test_config/test_scripts_styles/test_config.py --cov=src/djlint --cov-branch \
|
2022-07-28 18:58:03 +00:00
|
|
|
--cov-report xml:coverage.xml --cov-report term-missing
|
|
|
|
|
|
2022-09-07 16:15:21 +00:00
|
|
|
pytest tests/test_config/test_scripts_styles/test_config.py::test_ignore
|
2022-07-28 18:58:03 +00:00
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
# pylint: disable=C0116
|
|
|
|
|
|
|
|
|
|
from click.testing import CliRunner
|
|
|
|
|
|
|
|
|
|
from src.djlint import main as djlint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_config(runner: CliRunner) -> None:
|
|
|
|
|
result = runner.invoke(
|
|
|
|
|
djlint,
|
|
|
|
|
[
|
|
|
|
|
"tests/test_config/test_scripts_styles/html.html",
|
|
|
|
|
"--check",
|
|
|
|
|
],
|
|
|
|
|
)
|
2022-09-07 16:15:21 +00:00
|
|
|
assert result.exit_code == 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_ignore(runner: CliRunner) -> None:
|
|
|
|
|
result = runner.invoke(
|
|
|
|
|
djlint,
|
|
|
|
|
[
|
|
|
|
|
"tests/test_config/test_scripts_styles/ignore.html",
|
|
|
|
|
"--check",
|
|
|
|
|
],
|
|
|
|
|
)
|
2022-07-28 18:58:03 +00:00
|
|
|
assert result.exit_code == 0
|
2022-11-08 07:33:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def text_blank_lines(runner: CliRunner) -> None:
|
|
|
|
|
result = runner.invoke(
|
|
|
|
|
djlint,
|
|
|
|
|
[
|
|
|
|
|
"tests/test_config/test_scripts_styles/blank_lines.html",
|
|
|
|
|
"--check",
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
assert result.exit_code == 0
|