Skip to content

Commit 9bfb816

Browse files
Byroncodex
andcommitted
test(refs): use POSIX paths for Git reference names
<!-- agent --> Restore Windows CI coverage for `PathLike` revision arguments. The test introduced in `6de90f1c` uses `Path("refs/heads/main")`, which emits backslashes on Windows. Those are invalid Git reference names, so resolving `SymbolicReference` fails during ref-name validation in all four files/reftable and SHA-1/SHA-256 variants. The same failures were already present in PR #2336, before the unrelated `patch_env()` change in PR #2340. Use `PurePosixPath` for the test's Git reference names, which use forward slashes on every platform. It still implements `os.PathLike`, preserving coverage through `SymbolicReference` and direct and nested `merge_base()` arguments alongside `PathLikeMock`. Keep native `Path` for filesystem operations elsewhere in the module and preserve production validation. Assisted-by: GPT 6.1 Sol Co-authored-by: GPT 6.1 Sol <codex@openai.com>
1 parent f6db6e7 commit 9bfb816

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎test/test_refs.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import tarfile
1111
import unittest
1212
from itertools import chain
13-
from pathlib import Path
13+
from pathlib import Path, PurePosixPath
1414
from unittest.mock import Mock, patch
1515

1616
import pytest
@@ -270,7 +270,7 @@ def test_merge_base_preserves_nested_reference_arguments(object_format, ref_form
270270

271271
@pytest.mark.parametrize("object_format", ["sha1", "sha256"])
272272
@pytest.mark.parametrize("ref_format", ["files", "reftable"])
273-
@pytest.mark.parametrize("path_type", [Path, PathLikeMock])
273+
@pytest.mark.parametrize("path_type", [PurePosixPath, PathLikeMock])
274274
def test_revision_arguments_preserve_pathlike_paths(object_format, ref_format, path_type):
275275
with fixture_repo("exact-refs.sh", object_format, ref_format, "shadowed") as repo:
276276
local = repo.head.commit

0 commit comments

Comments
 (0)