Metadata-Version: 2.4
Name: baygon
Version: 0.7.0
Summary: Functional tests for teaching activities
Project-URL: Documentation, https://heig-tin-info.github.io/baygon/
Project-URL: Source, https://github.com/heig-tin-info/baygon
Project-URL: Tracker, https://github.com/heig-tin-info/baygon/issues
Project-URL: Homepage, https://github.com/heig-tin-info/baygon
Author-email: Yves Chevallier <yves.chevallier@heig-vd.ch>
License: Copyright 2025 HEIG-VD
        
        Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License-File: AUTHORS
License-File: LICENSE.txt
Keywords: functional-testing,testing
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: OS Independent
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Education :: Testing
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Requires-Dist: click<9,>=8.3.1
Requires-Dist: eval-type-backport<0.4,>=0.3.1
Requires-Dist: pydantic<3,>=2.12.5
Requires-Dist: pyyaml<7,>=6.0.3
Requires-Dist: rich<15,>=14.3.3
Requires-Dist: termynal<0.14,>=0.13.1
Requires-Dist: tinykernel<0.0.3,>=0.0.2
Requires-Dist: typer<0.25,>=0.24.1
Provides-Extra: dev
Requires-Dist: black<27,>=26.1.0; extra == 'dev'
Requires-Dist: mike<3,>=2.1.3; extra == 'dev'
Requires-Dist: mkdocs-material[imaging]<10,>=9.7.3; extra == 'dev'
Requires-Dist: mkdocs<2,>=1.6.1; extra == 'dev'
Requires-Dist: mkdocstrings[python]<2,>=1.0.3; extra == 'dev'
Requires-Dist: nox<2027,>=2026.2.9; extra == 'dev'
Requires-Dist: pytest-cov<8,>=7.0.0; extra == 'dev'
Requires-Dist: pytest<10,>=9.0.2; extra == 'dev'
Requires-Dist: ruff<0.16,>=0.15.4; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mike<3,>=2.1.3; extra == 'docs'
Requires-Dist: mkdocs-material[imaging]<10,>=9.7.3; extra == 'docs'
Requires-Dist: mkdocs<2,>=1.6.1; extra == 'docs'
Requires-Dist: mkdocstrings[python]<2,>=1.0.3; extra == 'docs'
Provides-Extra: lint
Requires-Dist: black<27,>=26.1.0; extra == 'lint'
Requires-Dist: ruff<0.16,>=0.15.4; extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest-cov<8,>=7.0.0; extra == 'test'
Requires-Dist: pytest<10,>=9.0.2; extra == 'test'
Description-Content-Type: text/markdown

# Baygon

[![GitHub issues](https://img.shields.io/github/issues/heig-tin-info/baygon.svg)](https://github.com/heig-tin-info/baygon/issues)
[![GitHub last commit](https://img.shields.io/github/last-commit/heig-tin-info/baygon.svg)](https://github.com/heig-tin-info/baygon/commits/master)
![Build and Deploy](https://github.com/heig-tin-info/baygon/workflows/Build%20and%20Deploy/badge.svg)
![Python](https://img.shields.io/pypi/pyversions/baygon)
[![PyPI version](https://img.shields.io/pypi/v/baygon)](https://pypi.org/project/baygon/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/baygon)](https://pypi.org/project/baygon/#files)
[![License](https://img.shields.io/pypi/l/baygon)](https://github.com/heig-tin-info/baygon/blob/master/LICENSE.txt)
[![codecov](https://codecov.io/github/heig-tin-info/baygon/branch/master/graph/badge.svg?token=hFuVW5z784)](https://codecov.io/github/heig-tin-info/baygon)

**K**ills **B**ugs **D**ead!

<img src="https://raw.githubusercontent.com/heig-tin-info/baygon/dev/docs/baygon.svg" data-canonical-src="https://raw.githubusercontent.com/heig-tin-info/baygon/dev/docs/baygon.svg" width="400"/>

This package is a minimalist functional test suite for binaries. It relies on a description of tests usually in `test.yml` or `test.json`.

The **documentation** is available [here](https://heig-tin-info.github.io/baygon/).

## Test file format

It can be either a `.yml` or a `.json` file.

```yml
version: 1
tests:
  - name: Arguments check
    tests:
      - name: No errors if two arguments
        args: [1, 2]
        exit: 0
      - name: Error if less than two arguments
        args: [1]
        exit: 1
  - name: Stdout is the sum of arguments
    args: [1, 2]
    stdout: []
  - name: Version on stderr
    args: ['--version']
    stderr:
      - regex: '\b\d\.\d\.\d\b'
      - contains: 'Version'
```

## Usage

```console
$ info-test -v ./a.out
Test 1: Arguments check
    Test 1.1: No errors if two arguments................ PASSED
    Test 1.2: Error if less than two arguments.......... PASSED
Test 2: Stdout is the sum of arguments.................. PASSED
Test 3: Version on stderr............................... PASSED

Ran 4 tests in 0.0s.

ok.
```

CLI highlights:

- Use `--pretty` to render rich panels for failing tests, including captured command telemetry.
- Pass `-T`/`--table` to display an aggregated summary table once the run completes.
- Provide a custom test definition with `-c`/`--config`. The legacy `-t` flag is still recognised but deprecated.

## Programmatic usage

Baygon now exposes the same building blocks used by the CLI so you can embed
the runner directly in your tooling:

```python
from baygon.config import load_config
from baygon.runtime import BaygonRunner

suite = load_config("tests/smoke.yml")
runner = BaygonRunner(suite, base_dir=Path("tests"))
report = runner.run()

for case in report.cases:
    print(f"{case.case.name}: {case.status}")
```

You can also extend Baygon by registering custom filters or matchers:

```python
from baygon.filters import Filter, register_filter

@register_filter("strip-digits")
class FilterStripDigits(Filter):
    def apply(self, value: str) -> str:
        return "".join(c for c in value if not c.isdigit())
```

## How to install?

```console
pip3 install baygon
```

## Build documentation

The site is powered by MkDocs Material. From the repository root:

```bash
uv sync --group docs
uv run --group docs mkdocs serve --strict
```

To create a production build:

```bash
uv run --group docs mkdocs build --strict
```

## Contributing ?

```console
git clone https://github.com/heig-tin-info/baygon.git
cd baygon
uv sync --group dev
```

### Tests

Install `pyenv` then install all required version of Python:

```bash
pyenv install 3.9.9
pyenv install 3.10.4
pyenv install 3.11.0
pyenv install 3.12.0
pyenv install 3.13.0
pyenv global 3.9.9 3.10.4 3.11.0 3.12.0 3.13.0
```

Then sync your uv environment:

```bash
uv sync --group dev
```

Run the automated checks:

```bash
uv run --group dev nox -s lint tests
```

Baygon can even test itself against all supported Python versions:

```bash
uv run baygon .venv/bin/baygon
```
