Skip to content

Improve hooks tests#1777

Merged
Byron merged 2 commits intogitpython-developers:mainfrom
EliahKagan:hooks-tests
Dec 21, 2023
Merged

Improve hooks tests#1777
Byron merged 2 commits intogitpython-developers:mainfrom
EliahKagan:hooks-tests

Conversation

@EliahKagan
Copy link
Copy Markdown
Member

@EliahKagan EliahKagan commented Dec 21, 2023

This improves the tests of git hooks in test_index.py:

  • f664a0b fixes and adds missing xfail marks for the WinBashStatus.Absent condition. This is a test bug from when I added the xfail marks in #1745. The Absent condition was detected correctly, but not always used, or used properly, in xfail markings.
  • e148647 adds a direct test of run_commit_hook itself. The other tests test specific kinds of hooks. run_commit_hook is public so it's reasonable for it to have its own test, plus I anticipate this will help future work.

Their commit messages include some more details, including rationale.

I have made sure to test on a Windows system that truly does not have bash.exe (as well testing the WinBashStatus.Wsl case, which CI confirms, and the WinBashStatus.Native case).

One might worry that I missed this before due to some further bug, but I believe not. Producing a genuine WslBashStatus.Absent condition on a Windows system that has a system-provided WSL-related bash.exe in System32 (which is searched regardless of what is in the PATH environment variable, as noted in the WinBashStatus.check docstring) is a bit tricky because renaming that file requires one to act as the TrustedInstaller user (as would the worse option of deleting it). At some point while working on #1745, I did not test this when I should have. I believe that is the only reason it was missed, rather than any underlying technical issue.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants