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. The installer verifies the GitHub release-asset SHA-256 digest before extract. 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.3.tar.gz (257.1 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.3-py3-none-any.whl (206.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: battest-1.0.3.tar.gz
  • Upload date:
  • Size: 257.1 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.3.tar.gz
Algorithm Hash digest
SHA256 36a3036d5e3ab2b34e8bd890bf1185aea467aa231f96a4318925956087c0ba2a
MD5 1f810e9e88ac23978cfeaf3442df9620
BLAKE2b-256 8ceb2f8471f6698401ce136511c6a12070ba2b9640fa6eccf5412a3c03dd91d8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: battest-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 206.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 14fbcad18621ae09ff165d1c4c0f272260469c2265b6e01a31d6be64d1c0229d
MD5 f31912a4c60af89ffd01727471ff2790
BLAKE2b-256 bf5b7d2284fc55fabb57d2b492726d04cbd1448d58ecbac5a47c70ccd04d44c9

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

This release

1.0.3 This release

2 files

1.0.2

2 files

1.0.1

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