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.3.0.tar.gz (29.6 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.3.0-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repo_smith-2.3.0.tar.gz
  • Upload date:
  • Size: 29.6 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.3.0.tar.gz
Algorithm Hash digest
SHA256 4a10bfd25df6da9c72c183a1f2cd629b9be314315e45a21a3a7a661cdcaf8af9
MD5 5c1e8b4b7c2e00c51f7758c47f6d3333
BLAKE2b-256 c25662d2988e38240ac1c52530a0bcf2fcc0895e5edb7c7359c2a64bfefa0fd5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repo_smith-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 29.0 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c28de6c86abfa1178320e4bfb1bba962908579cfee1f37c3c15bc35c3552af2
MD5 4cb36fe558f06c19b73b59e677b645fd
BLAKE2b-256 585b8d233d649c06c95971a1be3a4b9b7fdeae346373c69d144a10299466e7a8

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