mirror of
https://github.com/copier-org/copier.git
synced 2025-05-05 15:32:54 +00:00
Specific configurations for files that need no EOF
Pre-commit by default adds a single `\n` EOF to all files, but we have some tests that make sure that isn't done by Copier itself. This specific behavior is committed separately to keep track of it. I'm adding an exclusion filter for files named `whatever.noeof.suffix`, and those are skipped by the `end-of-file-fixer` hook. Also tests had to be changed accordingly. Nothing too special.
This commit is contained in:
parent
a549638c3c
commit
2ff11656e2
@ -32,6 +32,8 @@ repos:
|
||||
hooks:
|
||||
- id: trailing-whitespace
|
||||
- id: end-of-file-fixer
|
||||
# Some tests require no EOF or they will fail
|
||||
exclude: \.noeof\.
|
||||
- id: debug-statements
|
||||
- id: flake8
|
||||
additional_dependencies:
|
||||
|
@ -1,2 +1,2 @@
|
||||
_skip_if_exists:
|
||||
- "a.txt"
|
||||
- "a.noeof.txt"
|
||||
|
1
tests/demo_skip_src/meh/c.noeof.txt
Normal file
1
tests/demo_skip_src/meh/c.noeof.txt
Normal file
@ -0,0 +1 @@
|
||||
OVERWRITTEN
|
@ -1 +0,0 @@
|
||||
OVERWRITTEN
|
@ -74,12 +74,15 @@ def test_exclude_file(dst):
|
||||
def test_skip_if_exists(dst):
|
||||
copier.copy("tests/demo_skip_dst", dst)
|
||||
copier.copy(
|
||||
"tests/demo_skip_src", dst, skip_if_exists=["b.txt", "meh/c.txt"], force=True
|
||||
"tests/demo_skip_src",
|
||||
dst,
|
||||
skip_if_exists=["b.noeof.txt", "meh/c.noeof.txt"],
|
||||
force=True,
|
||||
)
|
||||
|
||||
assert (dst / "a.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "b.txt").read_text() == "SKIPPED"
|
||||
assert (dst / "meh" / "c.txt").read_text() == "SKIPPED"
|
||||
assert (dst / "a.noeof.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "b.noeof.txt").read_text() == "SKIPPED"
|
||||
assert (dst / "meh" / "c.noeof.txt").read_text() == "SKIPPED"
|
||||
|
||||
|
||||
def test_skip_if_exists_rendered_patterns(dst):
|
||||
@ -88,12 +91,12 @@ def test_skip_if_exists_rendered_patterns(dst):
|
||||
"tests/demo_skip_src",
|
||||
dst,
|
||||
data={"name": "meh"},
|
||||
skip_if_exists=["[[ name ]]/c.txt"],
|
||||
skip_if_exists=["[[ name ]]/c.noeof.txt"],
|
||||
force=True,
|
||||
)
|
||||
assert (dst / "a.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "b.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "meh" / "c.txt").read_text() == "SKIPPED"
|
||||
assert (dst / "a.noeof.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "b.noeof.txt").read_text() == "OVERWRITTEN"
|
||||
assert (dst / "meh" / "c.noeof.txt").read_text() == "SKIPPED"
|
||||
|
||||
|
||||
def test_config_exclude(dst, monkeypatch):
|
||||
|
Loading…
x
Reference in New Issue
Block a user