Skip to main content

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.zip from 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

  1. Install from PyPI:
pip install battest
  1. Create hello.cmd:
@echo off
echo hello
exit /b 0
  1. Create hello.battest.yaml next to it:
description: hello prints hello
script: hello.cmd
expect:
  exit_code: 0
  stdout:
    contains: hello
  1. 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

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

battest-1.0.1.tar.gz (251.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

battest-1.0.1-py3-none-any.whl (205.8 kB view details)

Uploaded Python 3

File details

Details for the file battest-1.0.1.tar.gz.

File metadata

  • Download URL: battest-1.0.1.tar.gz
  • Upload date:
  • Size: 251.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for battest-1.0.1.tar.gz
Algorithm Hash digest
SHA256 639b13a9225a82949eb34ed62c92f404d7d554beba3193e74d0e4867002aa39c
MD5 a0102c2a03851322f2a98429ae140849
BLAKE2b-256 cc349d149f2cef043d49d02aac8d3e162a7af59807bfecbd870ec86d9fd7ab3b

See more details on using hashes here.

File details

Details for the file battest-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: battest-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 205.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for battest-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 346b80c6464eb1862fbeea8dd7f8b2c18be2285ace69e522bc39649a5bb75f50
MD5 c982ce8c968b1d8fb0263b2f27c4051e
BLAKE2b-256 095b492e7d7d72dfcb92100a357969370b213f102a9a07e95dca2d14205e7461

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.9

2 files

1.0.8

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

This release

1.0.1 This release

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page