From a9f255d7cec6a4e5b85c537f9f01f9370bbbce28 Mon Sep 17 00:00:00 2001 From: benoit74 Date: Fri, 16 Feb 2024 14:08:40 +0100 Subject: [PATCH] Add some comments to explain the root_folder usage in tests --- tests/test_metadata.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_metadata.py b/tests/test_metadata.py index 02c6f58..acaae72 100644 --- a/tests/test_metadata.py +++ b/tests/test_metadata.py @@ -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(