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.
- 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).
-
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/functional
The 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.
-
Run a single test (useful while debugging):
pytest tests/functional/test_generate_cli.py::test_generate_with_multiple_plugins_combines_results
Add
-k <substring>or-vvfor tighter filtering or more verbose logs.
- 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.
- 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!