Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Re-enable Cygwin CI and get most tests passing#1455

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Byron merged 17 commits intogitpython-developers:mainfromDWesl:patch-1
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
96fae83
BUG: Fix is_cygwin_git to return True on Cygwin.
DWeslJun 10, 2022
a67862c
CI: Add a CI job with Cygwin tests
DWeslJun 10, 2022
3fc07ac
ENH: Update cygpath recodes to work with all installs
DWeslJun 10, 2022
d8ad56f
CI: Mark GHA repo safe for Git to use
DWeslJun 10, 2022
f96cea1
CI: Specify full path to python executables.
DWeslJun 10, 2022
d57a513
FIX: Fix flake8 command line
DWeslJun 11, 2022
5d874dd
BUG: Convert to native path before checking if absolute
DWeslJun 11, 2022
21113a8
STY: Remove import of now-unused function
DWeslJun 11, 2022
863c678
CI: Set temporary directory for tests.
DWeslJun 11, 2022
f990852
CI: Install virtualenv for Cygwin CI.
DWeslJun 11, 2022
9be148c
BUG: Use Cygwin paths for Cygwin git
DWeslJun 11, 2022
aafb92a
CI: Turn of command echo for tests
DWeslJun 11, 2022
54bae76
TST: Mark test_docs.Tutorials.test_submodules as xfail on Cygwin
DWeslJun 21, 2022
0eda0a5
TST: Mark test_repo.TestRepo.test_submodules as xfail on Cygwin
DWeslJun 21, 2022
7f3689d
TST: Mark test_submodule.TestSubmodule.test_root_module as xfail on C…
DWeslJun 21, 2022
c3fd6c1
FIX: Import pytest in tests.test_docs
DWeslJun 21, 2022
2996f40
FIX: Mark the correct test_submodule test as xfail on Cygwin
DWeslJun 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions.github/workflows/cygwin-test.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
name: test-cygwin

on:
push:
branches:
main
pull_request:
branches:
main

jobs:
build:
runs-on: windows-latest
env:
CHERE_INVOKING: 1
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v3
with:
fetch-depth: 9999
- uses: cygwin/cygwin-install-action@v2
with:
packages: python39 python39-pip python39-virtualenv git
- name: Tell git to trust this repo
shell: bash.exe -eo pipefail -o igncr "{0}"
run: /usr/bin/git config --global --add safe.directory $(pwd)
- name: Install dependencies and prepare tests
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
set -x
/usr/bin/python -m pip install --upgrade pip setuptools wheel
/usr/bin/python --version; /usr/bin/git --version
/usr/bin/git submodule update --init --recursive
/usr/bin/git fetch --tags
/usr/bin/python -m pip install -r requirements.txt
/usr/bin/python -m pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/git config --global user.name "Travis Runner"
# If we rewrite the user's config by accident, we will mess it up
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Lint with flake8
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
set -x
/usr/bin/python -m flake8
- name: Test with pytest
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/python -m pytest
continue-on-error: false
7 changes: 5 additions & 2 deletionsgit/repo/base.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@
from git.util import (
Actor,
finalize_process,
decygpath,
cygpath,
hex_to_bin,
expand_path,
remove_password_if_present,
Expand DownExpand Up@@ -175,7 +175,10 @@ def __init__(
if not epath:
epath = os.getcwd()
if Git.is_cygwin():
epath = decygpath(epath)
# Given how the tests are written, this seems more likely to catch
# Cygwin git used from Windows than Windows git used from Cygwin.
# Therefore changing to Cygwin-style paths is the relevant operation.
epath = cygpath(epath)

epath = epath or path or os.getcwd()
if not isinstance(epath, str):
Expand Down
6 changes: 4 additions & 2 deletionsgit/repo/fun.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
from git.exc import WorkTreeRepositoryUnsupported
from git.objects import Object
from git.refs import SymbolicReference
from git.util import hex_to_bin, bin_to_hex,decygpath
from git.util import hex_to_bin, bin_to_hex,cygpath
from gitdb.exc import (
BadObject,
BadName,
Expand DownExpand Up@@ -109,7 +109,9 @@ def find_submodule_git_dir(d: "PathLike") -> Optional["PathLike"]:

if Git.is_cygwin():
## Cygwin creates submodules prefixed with `/cygdrive/...` suffixes.
path = decygpath(path)
# Cygwin git understands Cygwin paths much better than Windows ones
# Also the Cygwin tests are assuming Cygwin paths.
path = cygpath(path)
if not osp.isabs(path):
path = osp.normpath(osp.join(osp.dirname(d), path))
return find_submodule_git_dir(path)
Expand Down
10 changes: 6 additions & 4 deletionsgit/util.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -310,7 +310,7 @@ def _cygexpath(drive: Optional[str], path: str) -> str:
else:
p = cygpath(p)
elif drive:
p = "/cygdrive/%s/%s" % (drive.lower(), p)
p = "/proc/cygdrive/%s/%s" % (drive.lower(), p)
p_str = str(p) # ensure it is a str and not AnyPath
return p_str.replace("\\", "/")

Expand All@@ -334,7 +334,7 @@ def cygpath(path: str) -> str:
"""Use :meth:`git.cmd.Git.polish_url()` instead, that works on any environment."""
path = str(path) # ensure is str and not AnyPath.
# Fix to use Paths when 3.5 dropped. or to be just str if only for urls?
if not path.startswith(("/cygdrive", "//")):
if not path.startswith(("/cygdrive", "//", "/proc/cygdrive")):
for regex, parser, recurse in _cygpath_parsers:
match = regex.match(path)
if match:
Expand All@@ -348,7 +348,7 @@ def cygpath(path: str) -> str:
return path


_decygpath_regex = re.compile(r"/cygdrive/(\w)(/.*)?")
_decygpath_regex = re.compile(r"(?:/proc)?/cygdrive/(\w)(/.*)?")


def decygpath(path: PathLike) -> str:
Expand DownExpand Up@@ -377,7 +377,9 @@ def is_cygwin_git(git_executable: PathLike) -> bool:


def is_cygwin_git(git_executable: Union[None, PathLike]) -> bool:
if not is_win:
if is_win:
# is_win seems to be true only for Windows-native pythons
# cygwin has os.name = posix, I think
return False

if git_executable is None:
Expand Down
8 changes: 8 additions & 0 deletionstest/test_docs.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,6 +5,9 @@
# This module is part of GitPython and is released under
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
import sys

import pytest

from test.lib import TestBase
from test.lib.helper import with_rw_directory
Expand DownExpand Up@@ -475,6 +478,11 @@ def test_references_and_objects(self, rw_dir):

repo.git.clear_cache()

@pytest.mark.xfail(
sys.platform == "cygwin",
reason="Cygwin GitPython can't find SHA for submodule",
raises=ValueError
)
def test_submodules(self):
# [1-test_submodules]
repo = self.rorepo
Expand Down
8 changes: 8 additions & 0 deletionstest/test_repo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,9 +11,12 @@
import os
import pathlib
import pickle
import sys
import tempfile
from unittest import mock, skipIf, SkipTest

import pytest

from git import (
InvalidGitRepositoryError,
Repo,
Expand DownExpand Up@@ -903,6 +906,11 @@ def test_repo_odbtype(self):
target_type = GitCmdObjectDB
self.assertIsInstance(self.rorepo.odb, target_type)

@pytest.mark.xfail(
sys.platform == "cygwin",
reason="Cygwin GitPython can't find submodule SHA",
raises=ValueError
)
def test_submodules(self):
self.assertEqual(len(self.rorepo.submodules), 1) # non-recursive
self.assertGreaterEqual(len(list(self.rorepo.iter_submodules())), 2)
Expand Down
8 changes: 8 additions & 0 deletionstest/test_submodule.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,8 +3,11 @@
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
import os
import shutil
import sys
from unittest import skipIf

import pytest

import git
from git.cmd import Git
from git.compat import is_win
Expand DownExpand Up@@ -437,6 +440,11 @@ def test_base_rw(self, rwrepo):
def test_base_bare(self, rwrepo):
self._do_base_tests(rwrepo)

@pytest.mark.xfail(
sys.platform == "cygwin",
reason="Cygwin GitPython can't find submodule SHA",
raises=ValueError
)
@skipIf(
HIDE_WINDOWS_KNOWN_ERRORS,
"""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp