Skip to main content

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.

Metadata

Release files for repo-smith 2.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo-smith 2.7.0
File Size Uploaded
repo_smith-2.7.0.tar.gz 71.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repo-smith 2.7.0
File Interpreter ABI Platform
repo_smith-2.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 107.8 kB

Release files / repo_smith-2.7.0.tar.gz

Download URL repo_smith-2.7.0.tar.gz
Size 71.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3e436f2b913abf42b8bc80c32c9e0c9d6be64f92c1d115a5b501eb5d45af74e7
BLAKE2b-256 checksum
How to use checksums
bf5c360c42288245362732f655697143ebd097b5413c5edec30500049d718cca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / repo_smith-2.7.0-py3-none-any.whl

Download URL repo_smith-2.7.0-py3-none-any.whl
Size 35.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8431b8e6dac72d5f79ce6524ed6c1d2140accaf0ba89017258c06be99ff89b1b
BLAKE2b-256 checksum
How to use checksums
416523ce3613c580e4f6406868e896dff728757ffd4c0b9b1e28dbe1fbbc0384
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release history Release notifications | RSS feed

This release

2.7.0 This release

2 release files

2.6.1

2 release files

2.5.3

2 release files

2.5.2

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.11.3

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.5

2 release files

0.6.4

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page