Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 1 addition & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,9 @@
# repo-smith

YAML-based configuration for Git repository initialization for unit testing
Declarative syntax for initializing Git repositories.

## Installation

```bash
pip install -U repo-smith
```

## Usage

Create a new configuration file (following the [specification](/specification.md)).

```yml
# 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.

```py
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:

- [Official specification](/specification.md)
- [Unit tests](./tests/)

## 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.
Loading