Crate gix_testtools
source ·Expand description
Utilities for testing gitoxide
crates, many of which might be useful for testing programs that use git
in general.
§Feature Flags
xz
— Use instead of plaintar
files, compress these to producetar.xz
files instead. This is useful if archives are uploaded intogit-lfs
, which doesn’t have built-in compression and metering counts towards uncompressed bytes transferred.
Re-exports§
Structs§
- A utility to set the current working dir to the given value, on drop.
- A utility to set environment variables, while unsetting them (or resetting them to their previous value) on drop.
- A wrapper for a running git-daemon process which is killed automatically on drop.
Enums§
- Define how
scripted_fixture_writable_with_args()
uses produces the writable copy.
Statics§
- The major, minor and patch level of the git version on the system.
Functions§
- A utility to copy the entire contents of
src_dir
intodst_dir
. - Load the fixture from
<crate-root>/tests/fixtures/<path>
and return its data, or panic. - Like
scripted_fixture_writable
, but does not prefix the fixture directory withtests
- Return the path to the
<crate-root>/tests/fixtures/<path>
directory. - Return the path to the
<crate-root>/fixtures/<path>
directory. - Run
git
inworking_dir
with all providedargs
. - Run the executable at
script_name
, likemake_repo.sh
ormy_setup.py
to produce a read-only directory to which the path is returned. - Like
scripted_fixture_read_only
, but does not prefix the fixture directory withtests
- Like
scripted_fixture_read_only()
], but passesargs
toscript_name
. - Like
scripted_fixture_read_only_with_args()
, but does not prefix the fixture directory withtests
- Run the executable at
script_name
, likemake_repo.sh
to produce a writable directory to which the tempdir is returned. It will be removed automatically, courtesy oftempfile::TempDir
. - Like
scripted_fixture_writable
, but does not prefix the fixture directory withtests
- Like
scripted_fixture_writable()
, but passesargs
toscript_name
while providing control over the way files are created withmode
. - Like
scripted_fixture_writable_with_args
, but does not prefix the fixture directory withtests
- Set the current working dir to
new_cwd
and return a type that returns to the previous working dir on drop. - Returns true if the given
major
,minor
andpatch
is smaller than the actual git version on the system to facilitate skipping a test on the caller. Will never return true on CI which is expected to have a recent enough git version. - Spawn a git daemon process to host all repository at or below
working_dir
. - Transform a verbose parser errors from raw bytes into a
BStr
to make printing/debugging human-readable.
Type Aliases§
- A result type to allow using the try operator
?
in unit tests.