copier/tests/test_tools.py
Jairo Llopis 67cc4ffde3
feat: nix support
- Provide a dev shell.
- Provide a nix package.
- Provide a nix flake.
- Development environment based on direnv.
- Docs.
- Configure Gitpod to use direnv and nix.
- Configure Cachix out of the box, and document how to use it.
- Add direnv and nix to CI.
- Satisfy some linters that came from Precommix, even when Precommix was later discarded.
- Mark some tests as impure.
- Run only pure tests when building Copier with Nix.
- Add poetry loader to direnv.
- Update contribution guide.
2023-01-18 09:40:08 +00:00

31 lines
964 B
Python

from pathlib import Path
from stat import S_IREAD
from plumbum.cmd import git
from poethepoet.app import PoeThePoet
from copier.tools import TemporaryDirectory
def test_types():
"""Ensure source code static typing."""
result = PoeThePoet(Path("."))(["types"])
assert result == 0
def test_temporary_directory_with_readonly_files_deletion():
"""Ensure temporary directories containing read-only files are properly deleted, whatever the OS."""
with TemporaryDirectory() as tmp_dir:
ro_file = Path(tmp_dir) / "readonly.txt"
with ro_file.open("w") as fp:
fp.write("don't touch me!")
ro_file.chmod(S_IREAD)
assert not Path(tmp_dir).exists()
def test_temporary_directory_with_git_repo_deletion():
"""Ensure temporary directories containing git repositories are properly deleted, whatever the OS."""
with TemporaryDirectory() as tmp_dir:
git("init")
assert not Path(tmp_dir).exists()