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.4.tar.gz (258.6 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.4-py3-none-any.whl (207.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: battest-1.0.4.tar.gz
  • Upload date:
  • Size: 258.6 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.4.tar.gz
Algorithm Hash digest
SHA256 a928876453fdb1a03e0a01ee93db2388ac0333527bcb3cbe4227baa4424c182f
MD5 b9efebd9f1ba80d75962d2c2a78418a8
BLAKE2b-256 449aed3b144dad95d7d2f5b5695d18e4e7416c6f1b26d67e5a20f2630a3be789

See more details on using hashes here.

File details

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

File metadata

  • Download URL: battest-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 207.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ce02362b3e6bd2fb80e77ba673ceb454264350a8c93ae02841c28cee89e96747
MD5 d8f5591844ec350571546ec7a579759a
BLAKE2b-256 ed4b36dd5cef011d5ba0cdb20678f3d59239e9f4eee12731344386e01a19d9ea

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.9

2 files

1.0.8

2 files

This release

1.0.4 This release

2 files

1.0.3

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