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

Commit96acc22

Browse files
authored
Merge pull request#1745 from EliahKagan/ci-windows
Test native Windows on CI
2 parentsa2644da +e00fffc commit96acc22

12 files changed

+350
-78
lines changed

‎.github/workflows/cygwin-test.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,7 @@ jobs:
7070
command -v git python
7171
git version
7272
python --version
73-
python -c 'import sys; print(sys.platform)'
74-
python -c 'import os; print(os.name)'
75-
python -c 'import git; print(git.compat.is_win)' # NOTE: Deprecated. Use os.name directly.
73+
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
7674
7775
-name:Test with pytest
7876
run:|

‎.github/workflows/pythonpackage.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,19 @@ permissions:
1010

1111
jobs:
1212
build:
13-
runs-on:ubuntu-latest
14-
1513
strategy:
1614
fail-fast:false
1715
matrix:
16+
os:["ubuntu-latest", "windows-latest"]
1817
python-version:["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
1918
include:
2019
-experimental:false
2120

21+
runs-on:${{ matrix.os }}
22+
2223
defaults:
2324
run:
24-
shell:/bin/bash --noprofile --norc -exo pipefail {0}
25+
shell:bash --noprofile --norc -exo pipefail {0}
2526

2627
steps:
2728
-uses:actions/checkout@v4
@@ -34,6 +35,12 @@ jobs:
3435
python-version:${{ matrix.python-version }}
3536
allow-prereleases:${{ matrix.experimental }}
3637

38+
-name:Set up WSL (Windows)
39+
if:startsWith(matrix.os, 'windows')
40+
uses:Vampire/setup-wsl@v2.0.2
41+
with:
42+
distribution:Debian
43+
3744
-name:Prepare this repo for tests
3845
run:|
3946
./init-tests-after-clone.sh
@@ -61,9 +68,16 @@ jobs:
6168
command -v git python
6269
git version
6370
python --version
64-
python -c 'import sys; print(sys.platform)'
65-
python -c 'import os; print(os.name)'
66-
python -c 'import git; print(git.compat.is_win)' # NOTE: Deprecated. Use os.name directly.
71+
python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")'
72+
73+
# For debugging hook tests on native Windows systems that may have WSL.
74+
-name:Show bash.exe candidates (Windows)
75+
if:startsWith(matrix.os, 'windows')
76+
run:|
77+
set +e
78+
bash.exe -c 'printenv WSL_DISTRO_NAME; uname -a'
79+
python -c 'import subprocess; subprocess.run(["bash.exe", "-c", "printenv WSL_DISTRO_NAME; uname -a"])'
80+
continue-on-error:true
6781

6882
-name:Check types with mypy
6983
run:|

‎test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ pytest-cov
99
pytest-instafail
1010
pytest-mock
1111
pytest-sugar
12+
sumtypes

‎test/test_config.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,15 @@
66
importglob
77
importio
88
importos
9+
importos.pathasosp
910
fromunittestimportmock
1011

12+
importpytest
13+
1114
fromgitimportGitConfigParser
1215
fromgit.configimport_OMD,cp
13-
fromtest.libimport (
14-
TestCase,
15-
fixture_path,
16-
SkipTest,
17-
)
18-
fromtest.libimportwith_rw_directory
19-
20-
importos.pathasosp
2116
fromgit.utilimportrmfile
17+
fromtest.libimportSkipTest,TestCase,fixture_path,with_rw_directory
2218

2319

2420
_tc_lock_fpaths=osp.join(osp.dirname(__file__),"fixtures/*.lock")
@@ -239,6 +235,11 @@ def check_test_value(cr, value):
239235
withGitConfigParser(fpa,read_only=True)ascr:
240236
check_test_value(cr,tv)
241237

238+
@pytest.mark.xfail(
239+
os.name=="nt",
240+
reason='Second config._has_includes() assertion fails (for "config is included if path is matching git_dir")',
241+
raises=AssertionError,
242+
)
242243
@with_rw_directory
243244
deftest_conditional_includes_from_git_dir(self,rw_dir):
244245
# Initiate repository path.

‎test/test_diff.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,17 @@
33
# This module is part of GitPython and is released under the
44
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
55

6-
importddt
6+
importos
7+
importos.pathasosp
78
importshutil
89
importtempfile
9-
fromgitimport (
10-
Repo,
11-
GitCommandError,
12-
Diff,
13-
DiffIndex,
14-
NULL_TREE,
15-
Submodule,
16-
)
17-
fromgit.cmdimportGit
18-
fromtest.libimport (
19-
TestBase,
20-
StringProcessAdapter,
21-
fixture,
22-
)
23-
fromtest.libimportwith_rw_directory
2410

25-
importos.pathasosp
11+
importddt
12+
importpytest
13+
14+
fromgitimportNULL_TREE,Diff,DiffIndex,GitCommandError,Repo,Submodule
15+
fromgit.cmdimportGit
16+
fromtest.libimportStringProcessAdapter,TestBase,fixture,with_rw_directory
2617

2718

2819
defto_raw(input):
@@ -318,6 +309,11 @@ def test_diff_with_spaces(self):
318309
self.assertIsNone(diff_index[0].a_path,repr(diff_index[0].a_path))
319310
self.assertEqual(diff_index[0].b_path,"file with spaces",repr(diff_index[0].b_path))
320311

312+
@pytest.mark.xfail(
313+
os.name=="nt",
314+
reason='"Access is denied" when tearDown calls shutil.rmtree',
315+
raises=PermissionError,
316+
)
321317
deftest_diff_submodule(self):
322318
"""Test that diff is able to correctly diff commits that cover submodule changes"""
323319
# Init a temp git repo that will be referenced as a submodule.

‎test/test_docs.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@
88

99
importpytest
1010

11+
fromgit.excimportGitCommandError
1112
fromtest.libimportTestBase
1213
fromtest.lib.helperimportwith_rw_directory
1314

14-
importos.path
15-
1615

1716
classTutorials(TestBase):
1817
deftearDown(self):
@@ -207,6 +206,14 @@ def update(self, op_code, cur_count, max_count=None, message=""):
207206
assertsm.module_exists()# The submodule's working tree was checked out by update.
208207
# ![14-test_init_repo_object]
209208

209+
@pytest.mark.xfail(
210+
os.name=="nt",
211+
reason=(
212+
"IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n"
213+
"'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'."
214+
),
215+
raises=GitCommandError,
216+
)
210217
@with_rw_directory
211218
deftest_references_and_objects(self,rw_dir):
212219
# [1-test_references_and_objects]

‎test/test_fun.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33

44
fromioimportBytesIO
55
fromstatimportS_IFDIR,S_IFREG,S_IFLNK,S_IXUSR
6-
fromosimportstat
6+
importos
77
importos.pathasosp
88

9+
importpytest
10+
911
fromgitimportGit
12+
fromgit.excimportGitCommandError
1013
fromgit.indeximportIndexFile
1114
fromgit.index.funimport (
1215
aggressive_tree_merge,
@@ -34,6 +37,14 @@ def _assert_index_entries(self, entries, trees):
3437
assert (entry.path,entry.stage)inindex.entries
3538
# END assert entry matches fully
3639

40+
@pytest.mark.xfail(
41+
os.name=="nt",
42+
reason=(
43+
"IndexFile.from_tree is broken on Windows (related to NamedTemporaryFile), see #1630.\n"
44+
"'git read-tree --index-output=...' fails with 'fatal: unable to write new index file'."
45+
),
46+
raises=GitCommandError,
47+
)
3748
deftest_aggressive_tree_merge(self):
3849
# Head tree with additions, removals and modification compared to its predecessor.
3950
odb=self.rorepo.odb
@@ -291,12 +302,12 @@ def test_linked_worktree_traversal(self, rw_dir):
291302
rw_master.git.worktree("add",worktree_path,branch.name)
292303

293304
dotgit=osp.join(worktree_path,".git")
294-
statbuf=stat(dotgit)
305+
statbuf=os.stat(dotgit)
295306
self.assertTrue(statbuf.st_mode&S_IFREG)
296307

297308
gitdir=find_worktree_git_dir(dotgit)
298309
self.assertIsNotNone(gitdir)
299-
statbuf=stat(gitdir)
310+
statbuf=os.stat(gitdir)
300311
self.assertTrue(statbuf.st_mode&S_IFDIR)
301312

302313
deftest_tree_entries_from_data_with_failing_name_decode_py3(self):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp