summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitalii Dmitriev <vitalii.dmitriev@unikie.com>2023-12-19 16:21:16 +0200
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-12-20 19:04:57 +0000
commitb1d1ece2fb0ae62e16c801b0de26736ccf5c77b4 (patch)
tree7616762adbd35a675b88cea42757881df54d004a
parent449b23b698d7d4b13909667a49a0698eb495eeaa (diff)
downloadgit-repo-b1d1ece2fb0ae62e16c801b0de26736ccf5c77b4.tar.gz
tests: setup user identity for tests
After a6413f5d a GitCommandError is raised. Since there were no user identity were set up, it fails: - ReviewableBranchTests from test_project.py - ResolveRepoRev and CheckRepoRev from test_wrapper.py Test: ./run_tests Change-Id: Id7f5772afe22c77fc4c8f8f0b8be1b627ed42187 Signed-off-by: Vitalii Dmitriev <vitalii.dmitriev@unikie.com> Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/398658 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Vitalii Dmitriev <dmit.vitalii@gmail.com> Commit-Queue: Vitalii Dmitriev <dmit.vitalii@gmail.com>
-rw-r--r--tests/conftest.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 3c312015..938051b3 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -72,3 +72,12 @@ def tmp_home_dir(monkeypatch, tmp_path_factory):
72 the function scope. 72 the function scope.
73 """ 73 """
74 return _set_home(monkeypatch, tmp_path_factory.mktemp("home")) 74 return _set_home(monkeypatch, tmp_path_factory.mktemp("home"))
75
76
77@pytest.fixture(autouse=True)
78def setup_user_identity(monkeysession, scope="session"):
79 """Set env variables for author and committer name and email."""
80 monkeysession.setenv("GIT_AUTHOR_NAME", "Foo Bar")
81 monkeysession.setenv("GIT_COMMITTER_NAME", "Foo Bar")
82 monkeysession.setenv("GIT_AUTHOR_EMAIL", "foo@bar.baz")
83 monkeysession.setenv("GIT_COMMITTER_EMAIL", "foo@bar.baz")