Skip to content

Commit

Permalink
Add some comments to explain the root_folder usage in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Feb 16, 2024
1 parent f61f00a commit a9f255d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ def dynamic_metadata() -> List[str]:

@pytest.fixture
def root_folder(tmp_path: Path) -> str:
"""
Returns a "virtual" root folder with a "virtual" git config
Git config comes from the tests/configs/gitconfig file
This is necessary to ensure tests run always with the same git configuration file,
to avoid variability coming from:
- tests ran on plain files (not linked to any git repo)
- tests ran on a repository fork (e.g myuser/hatch-openzim)
- tests ran with a different remote (nothing forces main remote to be named origin)
"""
git_folder = tmp_path / ".git"
git_folder.mkdir()
shutil.copy(
Expand Down

0 comments on commit a9f255d

Please sign in to comment.