From ccbb24b75347f2be151f236640102e856a057073 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 8 Dec 2017 11:34:51 -0800 Subject: [PATCH] pre-commit: improve test (#21443) Now covers: - `PYTHONPATH` based setup - relative virtualenv symlinks --- Formula/pre-commit.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Formula/pre-commit.rb b/Formula/pre-commit.rb index 50cf39e87a..74e005c753 100644 --- a/Formula/pre-commit.rb +++ b/Formula/pre-commit.rb @@ -47,7 +47,16 @@ class PreCommit < Formula - id: trailing-whitespace EOS system bin/"pre-commit", "install" - system bin/"pre-commit", "run", "--all-files" + (testpath/"f").write "hi\n" + system "git", "add", "f" + + ENV["GIT_AUTHOR_NAME"] = "test user" + ENV["GIT_AUTHOR_EMAIL"] = "test@example.com" + ENV["GIT_COMMITTER_NAME"] = "test user" + ENV["GIT_COMMITTER_EMAIL"] = "test@example.com" + git_exe = which("git") + ENV["PATH"] = "/usr/bin:/bin" + system git_exe, "commit", "-m", "test" end end end