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

Commit f5f07a0

Browse files
Apkawawoile
authored andcommitted
test: fix git_sandbox for git<2.33
for old git like git-2.30 the tests broke my ~/.gitconfig file and created thousands of `name=GitHub` lines Signed-off-by: apkawa <apkawa@gmail.com>
1 parent 467fa3c commit f5f07a0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎tests/conftest.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ def git_sandbox(monkeypatch: pytest.MonkeyPatch, tmp_path: Path):
2323
monkeypatch.delenv(var)
2424

2525
# Define a dedicated temporary git config
26-
monkeypatch.setenv("GIT_CONFIG_GLOBAL", str(tmp_path / "gitconfig"))
27-
cmd.run(f"git config --global user.name {SIGNER}")
28-
cmd.run(f"git config --global user.email {SIGNER_MAIL}")
26+
gitconfig = tmp_path / ".git" / "config"
27+
if not gitconfig.parent.exists():
28+
gitconfig.parent.mkdir()
29+
monkeypatch.setenv("GIT_CONFIG_GLOBAL", str(gitconfig))
30+
r = cmd.run(f"git config --file {gitconfig} user.name {SIGNER}")
31+
assert r.return_code == 0, r.err
32+
r = cmd.run(f"git config --file {gitconfig} user.email {SIGNER_MAIL}")
33+
assert r.return_code == 0, r.err
2934

3035

3136
@pytest.fixture(scope="function")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /