fixed test for github

This commit is contained in:
Christopher Pickering 2021-10-29 11:55:20 +03:00
parent 0111614913
commit 9a57551c7a
No known key found for this signature in database
GPG key ID: E14DB3B0A0FACF84
5 changed files with 26 additions and 1 deletions

View file

@ -1,6 +1,14 @@
Changelog
=========
0.5.9
-----
- Added option ``--use-gitignore`` to extend the excludes
- Changed default exclude matching
- Fixed windows exclude paths
- Fixed formatting of ``{%...%}`` tags in attributes
- Fixed formatting for for loops and nested conditions in attributes
0.5.8
-----
- Added require_pragma option

View file

@ -149,3 +149,14 @@ Usage:
.. code:: ini
max_attribute_length=10
use_gitignore
-------------
Add .gitignore excludes to the default exclude.
Usage:
.. code:: ini
use_gitignore = True

View file

@ -117,4 +117,5 @@ CLI Args
--require-pragma Only format or lint files that starts with a comment
with the text 'djlint:on'
--lint Lint for common issues. [default option]
--use-gitignore Use .gitignore file to extend excludes.
-h, --help Show this message and exit.

View file

@ -87,7 +87,7 @@ from .src import get_src
@click.option(
"--use-gitignore",
is_flag=True,
help="Use .gitignore file as exclude. [default option]",
help="Use .gitignore file to extend excludes.",
)
def main(
src: List[str],

View file

@ -13,6 +13,7 @@ for a single test, run::
"""
# pylint: disable=C0116
import os
from pathlib import Path
from click.testing import CliRunner
@ -23,6 +24,8 @@ def test_cli(runner: CliRunner) -> None:
result = runner.invoke(djlint, ["tests/config_gitignore/html_two.html", "--check"])
assert result.exit_code == 1
# create .git folder to make root
Path("tests/config_gitignore/.git").mkdir(parents=True, exist_ok=True)
# add a gitignore file
with open("tests/config_gitignore/.gitignore", "w") as git:
git.write("html_two.html")
@ -43,6 +46,8 @@ def test_pyproject(runner: CliRunner) -> None:
result = runner.invoke(djlint, ["tests/config_gitignore/html_two.html", "--check"])
assert result.exit_code == 1
# make a root
Path("tests/config_gitignore/.git").mkdir(parents=True, exist_ok=True)
# add a gitignore file
with open("tests/config_gitignore/.gitignore", "w") as git:
git.write("html_two.html")