module documentation

Utilities for interacting with cgit.

Class CompatTestCase Test case that requires git for compatibility checks.
Function check_for_daemon Check for a running TCP daemon.
Function git_version Attempt to determine the version of git currently installed.
Function import_repo_to_dir Import a repo from a fast-export file in a temporary directory.
Function remove_ro Undocumented
Function require_git_version Require git version >= version, or skip the calling test.
Function run_git Run a git command.
Function run_git_or_fail Run a git command, capture stdout/stderr, and fail if git fails.
Variable rmtree_ro Undocumented
Constant _DEFAULT_GIT Undocumented
Constant _REPOS_DATA_DIR Undocumented
Constant _VERSION_LEN Undocumented
def check_for_daemon(limit=10, delay=0.1, timeout=0.1, port=TCP_GIT_PORT):

Check for a running TCP daemon.

Defaults to checking 10 times with a delay of 0.1 sec between tries.

Returns: A boolean, true if a daemon is running on the specified port,
false if not.
Parameters
limitNumber of attempts before deciding no daemon is running.
delayDelay between connection attempts.
timeoutSocket timeout for connection attempts.
portPort on which we expect the daemon to appear.
def git_version(git_path=_DEFAULT_GIT):

Attempt to determine the version of git currently installed.

Returns: A tuple of ints of the form (major, minor, point, sub-point), or
None if no git installation was found.
Parameters
git_pathPath to the git executable; defaults to the version in the system path.
def import_repo_to_dir(name):

Import a repo from a fast-export file in a temporary directory.

These are used rather than binary repos for compat tests because they are more compact and human-editable, and we already depend on git.

Returns: The path to the imported repository.

Parameters
nameThe name of the repository export file, relative to dulwich/tests/data/repos.
def remove_ro(action, name, exc):

Undocumented

def require_git_version(required_version, git_path=_DEFAULT_GIT):

Require git version >= version, or skip the calling test.

Parameters
required_versionA tuple of ints of the form (major, minor, point, sub-point); omitted components default to 0.
git_pathPath to the git executable; defaults to the version in the system path.
Raises
ValueErrorif the required version tuple has too many parts.
SkipTestif no suitable git version was found at the given path.
def run_git(args, git_path=_DEFAULT_GIT, input=None, capture_stdout=False, capture_stderr=False, **popen_kwargs):

Run a git command.

Input is piped from the input parameter and output is sent to the standard streams, unless capture_stdout is set.

Returns: A tuple of (returncode, stdout contents, stderr contents).
If capture_stdout is False, None will be returned as stdout contents. If capture_stderr is False, None will be returned as stderr contents.
Parameters
argsA list of args to the git command.
git_pathPath to to the git executable.
inputInput data to be sent to stdin.
capture_stdoutWhether to capture and return stdout.
capture_stderrUndocumented
**popen_kwargsAdditional kwargs for subprocess.Popen; stdin/stdout args are ignored.
Raises
OSErrorif the git executable was not found.
def run_git_or_fail(args, git_path=_DEFAULT_GIT, input=None, **popen_kwargs):

Run a git command, capture stdout/stderr, and fail if git fails.

rmtree_ro =

Undocumented

_DEFAULT_GIT: str =

Undocumented

Value
'git'
_REPOS_DATA_DIR =

Undocumented

Value
os.path.abspath(os.path.join(os.path.dirname(__file__),
                             os.pardir,
                             os.pardir,
                             os.pardir,
                             'testdata',
                             'repos'))
_VERSION_LEN: int =

Undocumented

Value
4