Skip to content

Commit

Permalink
Fixup tests for whitespace error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
oskar456 committed Dec 21, 2021
1 parent 35d01a7 commit d809e24
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test_dzonegit.py
Expand Up @@ -34,12 +34,15 @@ def test_check_whitespace_errors(git_dir):
git_dir.chdir()
git_dir.join("whitespace").write(" ")
subprocess.call(["git", "add", "whitespace"])
dzonegit.check_whitespace_errors(dzonegit.get_head())
git_dir.join("whitespace.zone").write(" ")
subprocess.call(["git", "add", "whitespace.zone"])
with pytest.raises(ValueError):
dzonegit.check_whitespace_errors(dzonegit.get_head())
subprocess.call(["git", "commit", "-m", "whitespace"])
with pytest.raises(ValueError):
dzonegit.check_whitespace_errors("HEAD~", dzonegit.get_head())
subprocess.call(["git", "rm", "-f", "whitespace"])
subprocess.call(["git", "rm", "-f", "whitespace*"])
subprocess.call(["git", "commit", "-m", "rm whitespace"])
dzonegit.check_whitespace_errors(dzonegit.get_head())
dzonegit.check_whitespace_errors("HEAD~", dzonegit.get_head())
Expand Down Expand Up @@ -125,7 +128,7 @@ def test_get_altered_files(git_dir):
assert files == {Path("dummy"), Path("new")}
# Refers to test_check_whitespace_errors
files = set(dzonegit.get_altered_files("HEAD~", "D", "HEAD"))
assert files == {Path("whitespace")}
assert files == {Path("whitespace"), Path("whitespace.zone")}
subprocess.call(["git", "checkout", "-f", "HEAD"])
assert set(dzonegit.get_altered_files("HEAD", "AM")) == set()

Expand Down

0 comments on commit d809e24

Please sign in to comment.