livery.git._pytest_isolation¶
livery.git._pytest_isolation ¶
Every pytest with livery-git installed gives its git a config of the session's own.
Registered through the livery-git-isolation pytest11 entry point,
so every session in an environment with livery-git carries it. Before
the first test, every test's git reads GIT_CONFIG as its global
config, from a fresh directory in the system's temporary folder: one
identity, so a repository a test creates commits without a
config of its own, and none of the desk's settings, a signer among
them. A GIT_CONFIG_GLOBAL the outer environment already set is kept,
since an outer redirect is a redirect. The identity variables git reads
ahead of every config leave the session's environment, so a
colleague's clone a test configures commits as the colleague. Every
repository a test creates or clones starts from an empty template
directory beside that config, so its .git holds none of git's sample
hooks. The session's end removes the directory and the variable it
set; a session that is killed leaves the directory in the temporary
folder.
-p no:livery-git-isolation turns the plugin off for one session.
Functions:
| Name | Description |
|---|---|
session_config |
Return the text of the session's global git config. |
pytest_configure |
Drop the identity variables, and point git at the session's own config. |
pytest_unconfigure |
Remove the session's config, and the variable that named it. |
Attributes:
| Name | Type | Description |
|---|---|---|
GIT_CONFIG |
|
|
IDENTITY_VARIABLES |
|
|
TEMPLATES |
|
GIT_CONFIG
module-attribute
¶
IDENTITY_VARIABLES
module-attribute
¶
IDENTITY_VARIABLES = ('GIT_AUTHOR_NAME', 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_NAME', 'GIT_COMMITTER_EMAIL')
session_config ¶
Return the text of the session's global git config.
The config is GIT_CONFIG, and templates as git's template
directory. The path is written with forward slashes, which git
reads on every platform, since a backslash in a config value is
an escape.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
templates
|
PurePath
|
The empty directory new repositories start from. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The config's text. |
Source code in packages/git/src/livery/git/_pytest_isolation.py
pytest_configure ¶
Drop the identity variables, and point git at the session's own config.
Source code in packages/git/src/livery/git/_pytest_isolation.py
pytest_unconfigure ¶
Remove the session's config, and the variable that named it.