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

Commit58076c2

Browse files
authored
Merge pull request#1679 from EliahKagan/verbose-ci
Make clear every test's status in every CI run
2 parentsabd445f +4860f70 commit58076c2

13 files changed

+119
-130
lines changed

‎.github/workflows/cygwin-test.yml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ on: [push, pull_request, workflow_dispatch]
55
jobs:
66
build:
77
runs-on:windows-latest
8+
89
strategy:
910
fail-fast:false
11+
1012
env:
1113
CHERE_INVOKING:1
12-
SHELLOPTS:igncr
1314
TMP:"/tmp"
1415
TEMP:"/tmp"
16+
1517
defaults:
1618
run:
17-
shell:bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"
19+
shell:C:\cygwin\bin\bash.exe --noprofile --norc -exo pipefail -o igncr "{0}"
1820

1921
steps:
2022
-name:Force LF line endings
21-
run:git config --global core.autocrlf input
23+
run:|
24+
git config --global core.autocrlf false # Affects the non-Cygwin git.
25+
shell:bash
2226

2327
-uses:actions/checkout@v4
2428
with:
@@ -29,36 +33,42 @@ jobs:
2933
with:
3034
packages:python39 python39-pip python39-virtualenv git
3135

32-
-name:Show python and git versions
36+
-name:Special configuration for Cygwin's git
3337
run:|
34-
/usr/bin/python --version
35-
/usr/bin/git version
36-
37-
-name:Tell git to trust this repo
38-
run:|
39-
/usr/bin/git config --global --add safe.directory "$(pwd)"
38+
git config --global --add safe.directory "$(pwd)"
39+
git config --global core.autocrlffalse
4040
4141
-name:Prepare this repo for tests
4242
run:|
4343
TRAVIS=yes ./init-tests-after-clone.sh
4444
45-
-name:Further preparegitconfigurationfor tests
45+
-name:Setgituser identity and command aliasesfor the tests
4646
run:|
47-
/usr/bin/git config --global user.email "travis@ci.com"
48-
/usr/bin/git config --global user.name "Travis Runner"
47+
git config --global user.email "travis@ci.com"
48+
git config --global user.name "Travis Runner"
4949
# If we rewrite the user's config by accident, we will mess it up
5050
# and cause subsequent tests to fail
5151
cat test/fixtures/.gitconfig >> ~/.gitconfig
5252
5353
-name:Update PyPA packages
5454
run:|
55-
/usr/bin/python -m pip install --upgrade pip setuptools wheel
55+
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
56+
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
5657
5758
-name:Install project and test dependencies
5859
run:|
59-
/usr/bin/python -m pip install ".[test]"
60+
python -m pip install ".[test]"
61+
62+
-name:Show version and platform information
63+
run:|
64+
uname -a
65+
command -v git python
66+
git version
67+
python --version
68+
python -c 'import sys; print(sys.platform)'
69+
python -c 'import os; print(os.name)'
70+
python -c 'import git; print(git.compat.is_win)'
6071
6172
-name:Test with pytest
6273
run:|
63-
set +x
64-
/usr/bin/python -m pytest
74+
python -m pytest --color=yes -p no:sugar --instafail -vv

‎.github/workflows/lint.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ jobs:
77
runs-on:ubuntu-latest
88

99
steps:
10-
-uses:actions/checkout@v4
11-
-uses:actions/setup-python@v4
12-
with:
13-
python-version:"3.x"
14-
-uses:pre-commit/action@v3.0.0
10+
-uses:actions/checkout@v4
11+
12+
-uses:actions/setup-python@v4
13+
with:
14+
python-version:"3.x"
15+
16+
-uses:pre-commit/action@v3.0.0

‎.github/workflows/pythonpackage.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ permissions:
1010

1111
jobs:
1212
build:
13-
1413
runs-on:ubuntu-latest
14+
1515
strategy:
1616
fail-fast:false
1717
matrix:
@@ -20,6 +20,7 @@ jobs:
2020
-experimental:false
2121
-python-version:"3.12"
2222
experimental:true
23+
2324
defaults:
2425
run:
2526
shell:/bin/bash --noprofile --norc -exo pipefail {0}
@@ -36,16 +37,11 @@ jobs:
3637
python-version:${{ matrix.python-version }}
3738
allow-prereleases:${{ matrix.experimental }}
3839

39-
-name:Show python and git versions
40-
run:|
41-
python --version
42-
git version
43-
4440
-name:Prepare this repo for tests
4541
run:|
4642
TRAVIS=yes ./init-tests-after-clone.sh
4743
48-
-name:Prepare gitconfigurationfor tests
44+
-name:Set gituser identity and command aliasesfor the tests
4945
run:|
5046
git config --global user.email "travis@ci.com"
5147
git config --global user.name "Travis Runner"
@@ -55,17 +51,23 @@ jobs:
5551
5652
-name:Update PyPA packages
5753
run:|
58-
python -m pip install --upgrade pip
59-
if pip freeze --all | grep --quiet '^setuptools=='; then
60-
# Python prior to 3.12 ships setuptools. Upgrade it if present.
61-
python -m pip install --upgrade setuptools
62-
fi
63-
python -m pip install --upgrade wheel
54+
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
55+
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
6456
6557
-name:Install project and test dependencies
6658
run:|
6759
pip install ".[test]"
6860
61+
-name:Show version and platform information
62+
run:|
63+
uname -a
64+
command -v git python
65+
git version
66+
python --version
67+
python -c 'import sys; print(sys.platform)'
68+
python -c 'import os; print(os.name)'
69+
python -c 'import git; print(git.compat.is_win)'
70+
6971
-name:Check types with mypy
7072
run:|
7173
mypy -p git
@@ -75,7 +77,7 @@ jobs:
7577

7678
-name:Test with pytest
7779
run:|
78-
pytest
80+
pytest --color=yes -p no:sugar --instafail -vv
7981
continue-on-error:false
8082

8183
-name:Documentation

‎pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
55
[tool.pytest.ini_options]
66
python_files ='test_*.py'
77
testpaths ='test'# space separated list of paths from root e.g test tests doc/testing
8-
addopts ='--cov=git --cov-report=term --maxfail=10 --force-sugar --disable-warnings'
8+
addopts ='--cov=git --cov-report=term --disable-warnings'
99
filterwarnings ='ignore::DeprecationWarning'
1010
# --cov coverage
1111
# --cov-report term # send report to terminal term-missing -> terminal with line numbers html xml

‎test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ mypy
55
pre-commit
66
pytest
77
pytest-cov
8+
pytest-instafail
89
pytest-sugar

‎test/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
importos
88
importsys
99
importtempfile
10-
fromunittestimportSkipTest,skipIf
10+
fromunittestimportskipIf
1111

1212
fromgitimportRepo
1313
fromgit.objectsimportBlob,Tree,Commit,TagObject
@@ -126,7 +126,7 @@ def test_add_unicode(self, rw_repo):
126126
try:
127127
file_path.encode(sys.getfilesystemencoding())
128128
exceptUnicodeEncodeErrorase:
129-
raiseSkipTest("Environment doesn't support unicode filenames")frome
129+
raiseRuntimeError("Environment doesn't support unicode filenames")frome
130130

131131
withopen(file_path,"wb")asfp:
132132
fp.write(b"something")

‎test/test_config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def test_includes_order(self):
100100
# values must be considered as soon as they get them
101101
assertr_config.get_value("diff","tool")=="meld"
102102
try:
103+
# FIXME: Split this assertion out somehow and mark it xfail (or fix it).
103104
assertr_config.get_value("sec","var1")=="value1_main"
104105
exceptAssertionErrorase:
105106
raiseSkipTest("Known failure -- included values are not in effect right away")frome

‎test/test_fun.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
fromstatimportS_IFDIR,S_IFREG,S_IFLNK,S_IXUSR
33
fromosimportstat
44
importos.pathasosp
5-
fromunittestimportSkipTest
65

76
fromgitimportGit
87
fromgit.indeximportIndexFile
@@ -279,7 +278,7 @@ def test_linked_worktree_traversal(self, rw_dir):
279278
"""Check that we can identify a linked worktree based on a .git file"""
280279
git=Git(rw_dir)
281280
ifgit.version_info[:3]< (2,5,1):
282-
raiseSkipTest("worktree feature unsupported")
281+
raiseRuntimeError("worktree feature unsupported (test needs git 2.5.1 or later)")
283282

284283
rw_master=self.rorepo.clone(join_path_native(rw_dir,"master_repo"))
285284
branch=rw_master.create_head("aaaaaaaa")

‎test/test_index.py

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77

88
fromioimportBytesIO
99
importos
10+
importos.pathasosp
11+
frompathlibimportPath
1012
fromstatimportS_ISLNK,ST_MODE
11-
importtempfile
12-
fromunittestimportskipIf
1313
importshutil
14+
importtempfile
15+
16+
importpytest
1417

1518
fromgitimport (
1619
IndexFile,
@@ -28,21 +31,26 @@
2831
fromgit.index.funimporthook_path
2932
fromgit.index.typimportBaseIndexEntry,IndexEntry
3033
fromgit.objectsimportBlob
31-
fromtest.libimportTestBase,fixture_path,fixture,with_rw_repo
32-
fromtest.libimportwith_rw_directory
33-
fromgit.utilimportActor,rmtree
34-
fromgit.utilimportHIDE_WINDOWS_KNOWN_ERRORS,hex_to_bin
34+
fromtest.libimportTestBase,fixture,fixture_path,with_rw_directory,with_rw_repo
35+
fromgit.utilimportActor,hex_to_bin,rmtree
3536
fromgitdb.baseimportIStream
3637

37-
importos.pathasosp
38-
fromgit.cmdimportGit
38+
HOOKS_SHEBANG="#!/usr/bin/env sh\n"
3939

40-
frompathlibimportPath
4140

42-
HOOKS_SHEBANG="#!/usr/bin/env sh\n"
41+
def_found_in(cmd,directory):
42+
"""Check if a command is resolved in a directory (without following symlinks)."""
43+
path=shutil.which(cmd)
44+
returnpathandPath(path).parent==Path(directory)
45+
4346

4447
is_win_without_bash=is_winandnotshutil.which("bash.exe")
4548

49+
is_win_with_wsl_bash=is_winand_found_in(
50+
cmd="bash.exe",
51+
directory=Path(os.getenv("WINDIR"))/"System32",
52+
)
53+
4654

4755
def_make_hook(git_dir,name,content,make_exec=True):
4856
"""A helper to create a hook"""
@@ -422,14 +430,6 @@ def _count_existing(self, repo, files):
422430

423431
# END num existing helper
424432

425-
@skipIf(
426-
HIDE_WINDOWS_KNOWN_ERRORSandGit.is_cygwin(),
427-
"""FIXME: File "C:\\projects\\gitpython\\git\\test\\test_index.py", line 642, in test_index_mutation
428-
self.assertEqual(fd.read(), link_target)
429-
AssertionError: '!<symlink>\xff\xfe/\x00e\x00t\x00c\x00/\x00t\x00h\x00a\x00t\x00\x00\x00'
430-
!= '/etc/that'
431-
""",
432-
)
433433
@with_rw_repo("0.1.6")
434434
deftest_index_mutation(self,rw_repo):
435435
index=rw_repo.index
@@ -910,7 +910,11 @@ def test_pre_commit_hook_fail(self, rw_repo):
910910
else:
911911
raiseAssertionError("Should have caught a HookExecutionError")
912912

913-
@skipIf(HIDE_WINDOWS_KNOWN_ERRORS,"TODO: fix hooks execution on Windows: #703")
913+
@pytest.mark.xfail(
914+
is_win_without_bashoris_win_with_wsl_bash,
915+
reason="Specifically seems to fail on WSL bash (in spite of #1399)",
916+
raises=AssertionError,
917+
)
914918
@with_rw_repo("HEAD",bare=True)
915919
deftest_commit_msg_hook_success(self,rw_repo):
916920
commit_message="commit default head by Frèderic Çaufl€"

‎test/test_repo.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
importpickle
1414
importsys
1515
importtempfile
16-
fromunittestimportmock,skipIf,SkipTest,skip
16+
fromunittestimportmock,skip
1717

1818
importpytest
1919

@@ -41,10 +41,8 @@
4141
UnsafeProtocolError,
4242
)
4343
fromgit.repo.funimporttouch
44-
fromtest.libimportTestBase,with_rw_repo,fixture
45-
fromgit.utilimportHIDE_WINDOWS_KNOWN_ERRORS,cygpath
46-
fromtest.libimportwith_rw_directory
47-
fromgit.utilimportjoin_path_native,rmtree,rmfile,bin_to_hex
44+
fromgit.utilimportbin_to_hex,cygpath,join_path_native,rmfile,rmtree
45+
fromtest.libimportTestBase,fixture,with_rw_directory,with_rw_repo
4846

4947
importos.pathasosp
5048

@@ -764,16 +762,6 @@ def test_blame_accepts_rev_opts(self, git):
764762
self.rorepo.blame("HEAD","README.md",rev_opts=["-M","-C","-C"])
765763
git.assert_called_once_with(*expected_args,**boilerplate_kwargs)
766764

767-
@skipIf(
768-
HIDE_WINDOWS_KNOWN_ERRORSandGit.is_cygwin(),
769-
"""FIXME: File "C:\\projects\\gitpython\\git\\cmd.py", line 671, in execute
770-
raise GitCommandError(command, status, stderr_value, stdout_value)
771-
GitCommandError: Cmd('git') failed due to: exit code(128)
772-
cmdline: git add 1__��ava verb��ten 1_test _myfile 1_test_other_file
773-
1_��ava-----verb��ten
774-
stderr: 'fatal: pathspec '"1__çava verböten"' did not match any files'
775-
""",
776-
)
777765
@with_rw_repo("HEAD",bare=False)
778766
deftest_untracked_files(self,rwrepo):
779767
forrun,repo_addinenumerate((rwrepo.index.add,rwrepo.git.add)):
@@ -1245,7 +1233,7 @@ def test_merge_base(self):
12451233
deftest_is_ancestor(self):
12461234
git=self.rorepo.git
12471235
ifgit.version_info[:3]< (1,8,0):
1248-
raiseSkipTest("git merge-base --is-ancestor feature unsupported")
1236+
raiseRuntimeError("git merge-base --is-ancestor feature unsupported (test needs git 1.8.0 or later)")
12491237

12501238
repo=self.rorepo
12511239
c1="f6aa8d1"
@@ -1293,7 +1281,7 @@ def test_git_work_tree_dotgit(self, rw_dir):
12931281
based on it."""
12941282
git=Git(rw_dir)
12951283
ifgit.version_info[:3]< (2,5,1):
1296-
raiseSkipTest("worktree feature unsupported")
1284+
raiseRuntimeError("worktree feature unsupported (test needs git 2.5.1 or later)")
12971285

12981286
rw_master=self.rorepo.clone(join_path_native(rw_dir,"master_repo"))
12991287
branch=rw_master.create_head("aaaaaaaa")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp