# Development

For anyone working from a clone of the source. Install it with `pip install -e . pytest`, and give the clone's copy its own `--data-dir` where an installed copy runs on the same computer.

## Tests and the demo

| Command | What it does |
|---|---|
| `python -m pytest` | Runs the tests against fake KVMs; no hardware needed |
| `ruff check . && mypy` | The other two checks every push gets (`pip install ruff mypy`) |
| `python -m tests.demo` | A wall of fake KVMs in every state, at `http://127.0.0.1:8788/` |
| `python -m tests.demo --fresh` | The same, starting from the first-run setup |

The demo's sign-in password is `DEMO_PASSWORD` in `tests/demo.py`.

## Tests in a browser

Two test files press what a person presses, in a real browser. They need Playwright, which is for these tests only; without it they are skipped.

```
pip install playwright && python -m playwright install chromium
python -m pytest tests/test_in_a_browser.py tests/test_in_a_browser_with_the_program_itself.py
```

## Tests on a busy computer

`tools/under_load.py` runs tests the way a busy computer does, so that a test that takes timing for granted fails on purpose:

```
python tools/under_load.py --copies 6 --burners 12 --cores 0-7 -- tests/test_live.py
```

## Contributing

Reports are welcome; pull requests are not taken. [CONTRIBUTING.md](https://github.com/qkvm/qkvm/blob/main/CONTRIBUTING.md) says why, and what helps.

## Related

- [About](https://qkvm.com/docs/web/about)
- [Command line](https://qkvm.com/docs/web/command-line)
- [The API](https://qkvm.com/docs/web/the-api)

[Full reference](https://github.com/qkvm/qkvm/blob/main/GUIDE.md#development)
