Skip to content

Commit

Permalink
test(exclude): split bundled test into individual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sisp authored and yajo committed Nov 30, 2023
1 parent 8383bc9 commit df2c623
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_exclude.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,44 @@ def test_config_exclude_with_subdirectory(
run_copy(str(src), dst, quiet=True)
assert (dst / "copier.yml").exists()


def test_config_exclude_with_subdirectory_dot(
tmp_path_factory: pytest.TempPathFactory,
) -> None:
"""Default excludes are applied when subdirectory is `.`."""
# Make sure the file under test is in the list of default excludes
assert "copier.yml" in DEFAULT_EXCLUDE

src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
build_file_tree(
{src / "copier.yml": "_subdirectory: '.'", src / "template" / "copier.yml": ""}
)
run_copy(str(src), dst, quiet=True)
assert not (dst / "template" / "copier.yml").exists()


def test_config_exclude_with_subdirectory_empty_string(
tmp_path_factory: pytest.TempPathFactory,
) -> None:
"""Default excludes are applied when subdirectory is `""`."""
# Make sure the file under test is in the list of default excludes
assert "copier.yml" in DEFAULT_EXCLUDE

src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
build_file_tree(
{src / "copier.yml": "_subdirectory: ''", src / "template" / "copier.yml": ""}
)
run_copy(str(src), dst, quiet=True)
assert not (dst / "template" / "copier.yml").exists()


def test_config_exclude_without_subdirectory(
tmp_path_factory: pytest.TempPathFactory,
) -> None:
"""Default excludes are applied when no subdirectory is specified."""
# Make sure the file under test is in the list of default excludes
assert "copier.yml" in DEFAULT_EXCLUDE

src, dst = map(tmp_path_factory.mktemp, ("src", "dst"))
build_file_tree({src / "copier.yml": "", src / "template" / "copier.yml": ""})
run_copy(str(src), dst, quiet=True)
Expand Down

0 comments on commit df2c623

Please sign in to comment.