mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-11-14 16:27:13 +00:00
Cover `repo sync -n` & `-l` on existing checkouts (interleaved & phased), projects that were never fetched, and two-phase syncs with a superproject. `-l` must not touch the network, which the tests check by taking the server offline. Also cover tags (`--no-tags` & `sync-tags`), `--prune`, `--force-sync`, `--force-remove-dirty` & `-d`. Teach the harness to simulate outages (`GitHost.offline`) and to collect the requests made during a block (`GitHost.watch_requests`), and add a few `RepoClient` helpers. Bug: 566270944 Change-Id: I96b4729a7d4e5b58bc57fb46a060beda35549979 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/648545 Tested-by: Brian Gan <brgan@google.com> Commit-Queue: Brian Gan <brgan@google.com> Reviewed-by: Gavin Mak <gavinmak@google.com>
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.