Skip to main content

Provide a gitconfig sandbox for testing

Project description

pytest-gitconfig

CI pre-commit.ci status PyPI PyPI - License codecov

Provide a gitconfig sandbox for testing

Getting started

Install pytest-gitconfig:

# pip
pip install pytest-gitconfig
# pipenv
pipenv install pytest-gitconfig
# PDM
pdm add pytest-gitconfig

Provided fixtures

All fixtures are session-scoped.

gitconfig -> GitConfig

This is the main fixture which is creating a new and clean git config file for the test session.

By default, it will set 3 settings:

  • user.name
  • user.email
  • init.defaultBranch

The fixture when required provide a GitConfig object with the following methods:

  • gitconfig.set() accepting either a dict with the parsed data sections or key-values with dotted key names.
  • gitconfig.get() to get a setting given its dotted key.

git_user_name -> str

Provide the initial user.name setting. By default gitconfig.DEFAULT_GIT_USER_NAME. Override to provide a different initial value.

git_user_email -> str

Provide the initial user.email setting. By default gitconfig.DEFAULT_GIT_USER_EMAIL. Override to provide a different initial value.

git_init_default_branch -> str

Provide the initial init.defaultBranch setting. By default gitconfig.DEFAULT_GIT_BRANCH (main). Override to provide a different initial value.

sessionpatch -> pytest.MonkeyPatch

A pytest.MonkeyPatch session instance.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_gitconfig-0.2.0.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

pytest_gitconfig-0.2.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page