|
1 | 1 | # pytest-just |
2 | 2 | A pytest plugin for testing justfiles. |
| 3 | +[](https://github.com/DataBooth/pytest-just/actions/workflows/ci.yml) |
| 4 | +[](https://pypi.org/project/pytest-just/) |
| 5 | +[](https://pypi.org/project/pytest-just/) |
| 6 | +[](https://github.com/DataBooth/pytest-just/blob/main/LICENSE) |
| 7 | + |
| 8 | +## Package status |
| 9 | +`pytest-just` is published on PyPI. |
| 10 | + |
| 11 | +- PyPI: https://pypi.org/project/pytest-just/ |
| 12 | +- Source: https://github.com/DataBooth/pytest-just |
| 13 | +- Latest release notes: `RELEASE_NOTES.md` |
3 | 14 | ## What is pytest-just? |
4 | 15 | `pytest-just` is a plugin that adds a session-scoped `just` fixture to pytest so you can test `justfile` contracts directly in your test suite. |
5 | 16 |
|
@@ -28,11 +39,34 @@ This catches automation drift early without requiring full end-to-end execution |
28 | 39 | - Lint/format checks: `ruff` |
29 | 40 | - Type checks: `ty` |
30 | 41 | - Logging: `loguru` |
| 42 | +## Install from PyPI |
| 43 | +Add `pytest-just` to your test dependencies: |
| 44 | + |
| 45 | +```bash |
| 46 | +uv add --dev pytest-just |
| 47 | +``` |
| 48 | + |
| 49 | +You also need the `just` binary available in your environment: |
| 50 | + |
| 51 | +```bash |
| 52 | +just --version |
| 53 | +``` |
| 54 | + |
| 55 | +## Quick start (package usage) |
| 56 | +Create tests that use the plugin fixture: |
31 | 57 |
|
32 | | -## Quick start |
| 58 | +```python |
| 59 | +import pytest |
| 60 | + |
| 61 | +@pytest.mark.justfile |
| 62 | +def test_ci_depends_on_test(just): |
| 63 | + just.assert_exists("ci") |
| 64 | + just.assert_depends_on("ci", ["test"], transitive=True) |
| 65 | +``` |
| 66 | + |
| 67 | +Run: |
33 | 68 | ```bash |
34 | | -uv sync |
35 | | -uv run pytest |
| 69 | +uv run pytest -q |
36 | 70 | ``` |
37 | 71 | ## How does pytest-just work? |
38 | 72 | `pytest-just` primarily validates recipe contracts instead of running full recipe side effects. It asks `just` for structured metadata and rendered recipe text: |
@@ -94,6 +128,7 @@ Sample real-world-inspired justfiles live under `examples/public/` and include: |
94 | 128 | Use them to exercise fixture behaviour while developing the plugin. |
95 | 129 |
|
96 | 130 | ## Development workflow |
| 131 | +If you are contributing to this repository: |
97 | 132 | ```bash |
98 | 133 | uv sync --extra dev |
99 | 134 | uv run ruff check . |
|
0 commit comments