Make clear every test's status in every CI run by EliahKagan · Pull Request #1679 · gitpython-developers/GitPython
from io import BytesIO import os import os.path as osp from pathlib import Path from stat import S_ISLNK, ST_MODE import tempfile from unittest import skipIf import shutil import tempfile
import pytest
from git import ( IndexFile,
import os.path as osp from git.cmd import Git HOOKS_SHEBANG = "#!/usr/bin/env sh\n"
from pathlib import Path
HOOKS_SHEBANG = "#!/usr/bin/env sh\n" def _found_in(cmd, directory): """Check if a command is resolved in a directory (without following symlinks).""" path = shutil.which(cmd) return path and Path(path).parent == Path(directory)
is_win_without_bash = is_win and not shutil.which("bash.exe")
is_win_with_wsl_bash = is_win and _found_in( cmd="bash.exe", directory=Path(os.getenv("WINDIR")) / "System32", )
def _make_hook(git_dir, name, content, make_exec=True): """A helper to create a hook"""
# END num existing helper
@skipIf( HIDE_WINDOWS_KNOWN_ERRORS and Git.is_cygwin(), """FIXME: File "C:\\projects\\gitpython\\git\\test\\test_index.py", line 642, in test_index_mutation self.assertEqual(fd.read(), link_target) AssertionError: '!<symlink>\xff\xfe/\x00e\x00t\x00c\x00/\x00t\x00h\x00a\x00t\x00\x00\x00' != '/etc/that' """, ) @with_rw_repo("0.1.6") def test_index_mutation(self, rw_repo): index = rw_repo.index
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS, "TODO: fix hooks execution on Windows: #703") @pytest.mark.xfail( is_win_without_bash or is_win_with_wsl_bash, reason="Specifically seems to fail on WSL bash (in spite of #1399)", raises=AssertionError, ) @with_rw_repo("HEAD", bare=True) def test_commit_msg_hook_success(self, rw_repo): commit_message = "commit default head by Frèderic Çaufl€"