Skip to content

Commit a9f255d

Browse files
committed
Add some comments to explain the root_folder usage in tests
1 parent f61f00a commit a9f255d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_metadata.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ def dynamic_metadata() -> List[str]:
2323

2424
@pytest.fixture
2525
def root_folder(tmp_path: Path) -> str:
26+
"""
27+
Returns a "virtual" root folder with a "virtual" git config
28+
29+
Git config comes from the tests/configs/gitconfig file
30+
31+
This is necessary to ensure tests run always with the same git configuration file,
32+
to avoid variability coming from:
33+
- tests ran on plain files (not linked to any git repo)
34+
- tests ran on a repository fork (e.g myuser/hatch-openzim)
35+
- tests ran with a different remote (nothing forces main remote to be named origin)
36+
"""
2637
git_folder = tmp_path / ".git"
2738
git_folder.mkdir()
2839
shutil.copy(

0 commit comments

Comments
 (0)