diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 761af87..021e10d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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: diff --git a/tests/demo_skip_dst/a.txt b/tests/demo_skip_dst/a.noeof.txt similarity index 100% rename from tests/demo_skip_dst/a.txt rename to tests/demo_skip_dst/a.noeof.txt diff --git a/tests/demo_skip_dst/b.txt b/tests/demo_skip_dst/b.noeof.txt similarity index 100% rename from tests/demo_skip_dst/b.txt rename to tests/demo_skip_dst/b.noeof.txt diff --git a/tests/demo_skip_dst/meh/c.txt b/tests/demo_skip_dst/meh/c.noeof.txt similarity index 100% rename from tests/demo_skip_dst/meh/c.txt rename to tests/demo_skip_dst/meh/c.noeof.txt diff --git a/tests/demo_skip_src/a.txt b/tests/demo_skip_src/a.noeof.txt similarity index 100% rename from tests/demo_skip_src/a.txt rename to tests/demo_skip_src/a.noeof.txt diff --git a/tests/demo_skip_src/b.txt b/tests/demo_skip_src/b.noeof.txt similarity index 100% rename from tests/demo_skip_src/b.txt rename to tests/demo_skip_src/b.noeof.txt diff --git a/tests/demo_skip_src/copier.yml b/tests/demo_skip_src/copier.yml index 07baf0c..b39eb4b 100644 --- a/tests/demo_skip_src/copier.yml +++ b/tests/demo_skip_src/copier.yml @@ -1,2 +1,2 @@ _skip_if_exists: - - "a.txt" + - "a.noeof.txt" diff --git a/tests/demo_skip_src/meh/c.noeof.txt b/tests/demo_skip_src/meh/c.noeof.txt new file mode 100644 index 0000000..f5adba0 --- /dev/null +++ b/tests/demo_skip_src/meh/c.noeof.txt @@ -0,0 +1 @@ +OVERWRITTEN diff --git a/tests/demo_skip_src/meh/c.txt b/tests/demo_skip_src/meh/c.txt deleted file mode 100644 index f8b485e..0000000 --- a/tests/demo_skip_src/meh/c.txt +++ /dev/null @@ -1 +0,0 @@ -OVERWRITTEN \ No newline at end of file diff --git a/tests/test_copy.py b/tests/test_copy.py index f82ae5c..4a34f2a 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -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):