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.0.0b6.tar.gz (25.5 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.0.0b6-py3-none-any.whl (24.2 kB view details)

Uploaded Python 3

File details

Details for the file repo_smith-2.0.0b6.tar.gz.

File metadata

  • Download URL: repo_smith-2.0.0b6.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for repo_smith-2.0.0b6.tar.gz
Algorithm Hash digest
SHA256 54e1cbad457b499be8aa175408175cc9e27ad1f750c9be37fe96e59099c1e44c
MD5 4fa8ad81d221b3dd15b6b7e488e3c602
BLAKE2b-256 58bf922ad3bc13529387e7a33b6f81fe04576fc91a2ce1bb6bc45e8aaf7460ed

See more details on using hashes here.

File details

Details for the file repo_smith-2.0.0b6-py3-none-any.whl.

File metadata

  • Download URL: repo_smith-2.0.0b6-py3-none-any.whl
  • Upload date:
  • Size: 24.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for repo_smith-2.0.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 9f30f585541f5ed0075658632e80513391dd4540ae64394519f6ef60df13ed5c
MD5 fc3064fe41fca6aa466e60003f6a6fea
BLAKE2b-256 7a6c42f9783595fa3777b85f64ed16a35d24d003073e0a058d73fcfca7e72c1b

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