Skip to main content

YAML-based configuration for initializing Git repositories for unit testing

Project description

repo-smith

YAML-based configuration for Git repository initialization for unit testing

Installation

pip install -U repo-smith

Usage

Create a new configuration file (following the specification).

# File path: tests/specs/basic_spec.yml
name: Basic spec
description: Starting basic spec
initialization:
  steps:
    - name: Create filea.txt
      type: new-file
      filename: filea.txt
      contents: |
        Hello world
    - name: Add filea.txt
      type: add
      files:
        - filea.txt
    - name: Initial commit
      type: commit
      message: Initial commit
      id: initial-commit
    - name: v0 tag
      type: tag
      tag-name: v0

Create a unit test accordingly.

from repo_smith.initialize_repo import initialize_repo
from git import Repo

def test_dummy():
  repo_initializer = initialize_repo("test/specs/basic_spec.yml")
  with repo_initializer.initialize() as repo:
    # All unit testing code for the dummy repository goes here
    print(repo)

For more use cases of repo-smith, refer to:

FAQ

Why don't you assign every error to a constant and unit test against the constant?

Suppose the constant was X, and we unit tested that the error value was X, we would not capture any nuances if the value of X had changed by accident.

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

repo_smith-2.6.1.tar.gz (34.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo_smith-2.6.1-py3-none-any.whl (35.9 kB view details)

Uploaded Python 3

File details

Details for the file repo_smith-2.6.1.tar.gz.

File metadata

  • Download URL: repo_smith-2.6.1.tar.gz
  • Upload date:
  • Size: 34.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for repo_smith-2.6.1.tar.gz
Algorithm Hash digest
SHA256 1b0c18b159877caf1a05f74398f1a8d180375768e5871ce437680153920046bf
MD5 11b84d833d880fcb1b2a57b3e06aadb0
BLAKE2b-256 814b58151429a13561392303af401e24275eb026b4fb78ab3756ecc6733ad3a9

See more details on using hashes here.

File details

Details for the file repo_smith-2.6.1-py3-none-any.whl.

File metadata

  • Download URL: repo_smith-2.6.1-py3-none-any.whl
  • Upload date:
  • Size: 35.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for repo_smith-2.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 48aa76393dacd8532a5f5654699e7dffc09606406099974a89b556ab6fa495b5
MD5 107460ee6907a3c3d4e7ffa2c7f39b01
BLAKE2b-256 c546597a3cadf4df36eca76bfc9e5d952d83cd9a8f680c63c5b6b3117250edd6

See more details on using hashes here.

Supported by

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