Functional Testing Guide
May 19, 2026 · View on GitHub
Spikee ships with an end-to-end functional suite that exercises the CLI exactly the way a user would. The tests live under tests/functional and currently focus on verifying spikee generate across the key combinations of flags, plugins, and seed data. This document explains how to run them locally while you are iterating on the codebase.
1. Prerequisites
- Python 3.9 or later (check
python --version). - A local checkout of this repository.
pytestavailable in your environment (install it once withpip install pytestif you do not already have it).
2. Recommended workflow
-
Create and activate a virtual environment (only needed once per clone):
python -m venv .venv source .venv/bin/activate # Windows: .venv\Scripts\activate -
(Optional) Install Spikee locally. The functional harness performs a full
pip install .inside its own temporary venv, so pre-installing is not required. If you want an editable install for day-to-day hacking, run:pip install -e . -
Run the functional suite from the repository root:
pytest tests/functionalThe harness will:
- Spawn a temporary virtual environment for each session.
- Install the current
spikeewheel into that venv. - Bootstrap a scratch workspace (
spikee init) and overlay the fixtures undertests/functional/fixtures. - Execute the relevant
spikeeCLI commands (currentlyspikee generateandspikee test) and assert the outputs.
Optionally, run the functional suite from your workspace
pytest ../tests/functionalto use enviromental variables from your workspace .env file:SPIKEE_TESTS_USE_ISOLATED_VENV=1- Uses current environment instead of creating a new one for each test session. This is useful if you have already installed spikee in your current environment and want to speed up the tests by skipping the installation step.- Uses LLM provider inference keys.
-
Run a single test (useful while debugging):
pytest tests/functional/test_generate_cli.py::test_generate_with_multiple_plugins_combines_resultsAdd
-k <substring>or-vvfor tighter filtering or more verbose logs.
3. Notes & Troubleshooting
- Temporary workspaces: Every test uses Pytest’s
tmp_pathfixture. Nothing under your repo or existing workspaces is modified. - Dependencies: The fixture executes
pip install .inside its temporary venv, so the full dependency tree is downloaded automatically. Make sure you have network access (or a package mirror) the first time you run the suite. - Matrix coverage: Many tests are parameterised to run with
--match-languagesenabled and disabled. Expect the runtime to roughly double because both code paths are executed. - Debugging outputs: Use
pytest -sto keep stdout/stderr from the CLI if you are investigating a failure.
4. Next Steps
- Mirror this pattern for
spikee testworkflows to cover targets, judges, and attacks. - Wire the functional suite into CI so releases fail fast if a regression slips in.
That’s it—run pytest tests/functional anytime you need confidence that the end-to-end CLI behaviour remains intact. Happy hacking!