mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-11-13 15:57:35 +00:00
Add tests/e2e/conftest.py with fixtures for writing end-to-end tests: a session-wide git server, the published code under test, a per-test namespace of server repos, and a repo client with an isolated HOME & git config. Parametrize `git_defaults` to emulate Git 3 defaults (reftable & `main` as the default branch) on older git. Tests under tests/e2e/ are marked `e2e` and run after the unit tests in `./run_tests`. Use `-m e2e` or `-m 'not e2e'` to select them. They're skipped when `git http-backend` is unavailable, git is older than 2.28, or not running from a git checkout. Bug: 566270944 Change-Id: Ib61e4dd7acc41a65beec4d74f1635a25dce4e3be Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/647643 Commit-Queue: Brian Gan <brgan@google.com> Tested-by: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
954 B
954 B
Repo Tests
There is a mixture of pytest & Python unittest in here. We adopted pytest later on but didn't migrate existing tests (since they still work). New tests should be written using pytest only.
File layout
test_xxx.py: Unittests for thexxxmodule in the main repo codebase. Modules that are in subdirs normalize the/into_. For example, test_error.py is for the error.py module, and test_subcmds_forall.py is for the subcmds/forall.py module.- conftest.py: Custom pytest fixtures for sharing.
- utils_for_test.py: Helpers for sharing in tests.
- e2e/: Hermetic end-to-end tests that run the real
repoagainst a local git server.