Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>pyathyNew to Visual Studio Code? Get it now.
pyathy

pyathy

Mihai Banulescu at ADSD

| (0) | Free
Plain-English acceptance tests for Python command-line programs
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

pyathy

Test a Python command-line program with scenarios written in plain English, from VS Code.

You write .feature files (Gherkin: Scenario, When, Then) that type answers into your program, fix its dice rolls, and check what it prints. pyathy runs each scenario against a fresh start of your main.py and shows each run, then one line per scenario plus a total.

This extension puts the pyathy command on the terminal's PATH. No install: Python 3.11+ only. pyathy and everything it needs (pytest-bdd, pytest) are bundled inside the extension; no pip, no poetry, no venv.

Getting started

  1. Open a folder that holds main.py and features/ (File > Open Folder).
  2. Open the terminal (Terminal > New Terminal).
  3. Type pyathy.
my-game/
  main.py
  features/
    game.feature
Feature: Tic Tac Toe

  Scenario: X wins with the top row
    When I input 1, 4, 2, 5, 3
    Then "Player X wins!" is printed
    And the program asks "Play again? (y/n)"

Commands

In the terminal (pyathy -h lists every option):

pyathy            run every features/*.feature against main.py
pyathy -nf        rerun what failed last time, stopping at the first that still fails
pyathy -q         one line per scenario and the total
pyathy steps      every step you can use
pyathy -s         the features here against ./_solution/main.py (teachers)

The same from the Command Palette (pyathy: Run, pyathy: Run next failure, pyathy: Run quietly, pyathy: Show steps, pyathy: Run against _solution), from the play button on a .feature file, and Ctrl+Shift+T (Cmd+Shift+T on a Mac) for Run while a .feature or .py file is open. F5 in a .feature file (pyathy: Run this file) runs only that file: pyathy features/<that file>. They run in a terminal named pyathy, in the nearest folder above the open file that has a main.py or a features/ folder.

Which Python

The launcher runs the interpreter the Python extension (ms-python.python) has selected, when that extension is installed; else python3; else python. pyathy itself runs your program on the folder's Poetry environment or .venv when there is one, else on that same interpreter.

Writing features

.feature files get highlighting and a snippet for every built-in pyathy step: type the step's first words (I input, is printed, the program asks) and accept the completion. pyathy steps in the terminal prints the full list with what each step does. The steps of a *_steps.py next to your features complete the same way, after Given, When, Then, And.

Each time you open or save a .feature file, the extension runs pyathy check on it (your program is not run) and underlines what would stop a scenario: a line no step matches, a line that is not Gherkin, a file step pyathy cannot find in your program (red), and indentation unlike the rest of the file (yellow). Hover for the reason. When pyathy has a fix (the closest step, written with your values, or the usual indentation), the light bulb (Ctrl+., Cmd+. on a Mac) applies it.

If you also use the Cucumber extension (alexkrechik.cucumberautocomplete), both work side by side; to recommend it to everyone opening your project, add to .vscode/extensions.json:

{
  "recommendations": ["MB42.pyathy", "alexkrechik.cucumberautocomplete"]
}

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft