battest
Runtime test runner for Windows batch files (.bat / .cmd). battest executes
real cmd.exe, then asserts on exit code, stdout, stderr, environment, and
filesystem side effects.
battest is a sibling of Blinter (static analysis) and batch-spec (language spec). It does not depend on Blinter.
Requirements: Python 3.11+ and Windows (for battest run). License:
AGPL-3.0-or-later (COPYING). Changelog: docs/CHANGELOG.md.
A version bump of [project].version in pyproject.toml on main is the
release trigger (Windows exe zip, GitHub Release, and PyPI). If that version
never got a v* tag, the next successful main CI run retries the release.
Publishing to PyPI requires the PYPI_BATTEST GitHub Actions secret.
Installation
Option 1: Install via pip (recommended)
pip install battest
Option 2: Standalone executable (no Python)
If you prefer a standalone .exe over pip, use the one-line installer:
curl -L https://raw.githubusercontent.com/tboy1337/battest/main/scripts/install_battest.cmd -o install_battest.cmd && (call install_battest.cmd || cd .) && del install_battest.cmd
This installs the latest battest.exe to %LOCALAPPDATA%\Programs\battest\bin,
adds it to your user PATH, and handles updates automatically. Restart your
terminal or IDE after installation for PATH changes to take effect.
Manual zip download (fallback):
- Download the latest
Battest-vX.Y.Z.zipfrom GitHub Releases - Extract the archive; the executable is
Battest-vX.Y.Z\battest.exe - Some antivirus software may flag the executable as a false positive due to PyInstaller's runtime unpacking behavior. The executable is safe (all source code is open for inspection). pip installation avoids that issue.
Uninstall
Standalone executable (one-line installer):
curl -L https://raw.githubusercontent.com/tboy1337/battest/main/scripts/uninstall_battest.cmd -o uninstall_battest.cmd && (call uninstall_battest.cmd || cd .) && del uninstall_battest.cmd
pip installation:
pip uninstall battest
Five-minute start
- Install from PyPI:
pip install battest
- Create
hello.cmd:
@echo off
echo hello
exit /b 0
- Create
hello.battest.yamlnext to it:
description: hello prints hello
script: hello.cmd
expect:
exit_code: 0
stdout:
contains: hello
- Run:
battest run hello.battest.yaml
A passing case prints PASS hello .... A failing case prints a diff and exits
with status 1. Invalid YAML exits with status 2.
Case-directory form (same as batch-spec's corpus layout):
tests/hello/input.cmd
tests/hello/expect.yaml
Then battest run tests.
Documentation
- Fixture format
- CLI
- Mocking external commands
- PATH mock stub crate
- GitHub Action
- Changelog
- Encoding
- Safety
- Security
Development
git clone --recurse-submodules https://github.com/tboy1337/battest.git
cd battest
python -m pip install -e ".[dev]"
python scripts/generate_spec_data.py
python scripts/verify.py
Rust (PATH-mock stub crate in stub/):
cargo test --manifest-path stub/Cargo.toml --locked --all-targets
python scripts/check_rust_coverage.py
python scripts/build_stub.py
On Windows, battest run examples dogfoods examples/hello and
WindowsRescue flush_dns.cmd under PATH stubs.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file battest-1.0.2.tar.gz.
File metadata
- Download URL: battest-1.0.2.tar.gz
- Upload date:
- Size: 253.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fa8aae7366551cfa2626db85d70fa92c9c68267cfc96a8dafc00bacb33aed54
|
|
| MD5 |
162ab8fc090f1af74bcc94bcc0a84a62
|
|
| BLAKE2b-256 |
128522b28b9ff02a27aaefffe3349fefd4f66647b482766f1e04e606d4cdc0c5
|
File details
Details for the file battest-1.0.2-py3-none-any.whl.
File metadata
- Download URL: battest-1.0.2-py3-none-any.whl
- Upload date:
- Size: 206.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dd5919ddb45c22c641b15e3edc4164b20e1576619cfadc936a337d425487a1b
|
|
| MD5 |
7e7080d5bb1a1ee98489d833cae24343
|
|
| BLAKE2b-256 |
2a23969989124faf96ada6c1d415a6df9bd1b1e4fcccc20a9abb43082ec23f7b
|