Metadata-Version: 2.4
Name: csd-pytest-intent
Version: 0.3.1
Summary: The @intent decorator for pytest - links a test function to one or more CSD intent claims (INT-NNN). Spec validation and cross-runtime coverage live in the standalone `csd-intent` CLI.
Author: Rafael Pires
License: MIT
Project-URL: Homepage, https://github.com/PSA-Department-of-Engineering/csd-library/tree/main/pytest-intent
Project-URL: Documentation, https://github.com/PSA-Department-of-Engineering/csd-library/tree/main/pytest-intent#readme
Project-URL: Repository, https://github.com/PSA-Department-of-Engineering/csd-library
Project-URL: Issues, https://github.com/PSA-Department-of-Engineering/csd-library/issues
Project-URL: CSD methodology, https://github.com/PSA-Department-of-Engineering/cognitive-software-delivery
Project-URL: csd-intent (audit CLI), https://github.com/PSA-Department-of-Engineering/csd-library/tree/main/csd-intent
Keywords: pytest,intent,csd,testing,specification,tdd
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pytest>=7.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: mypy>=1.0; extra == "dev"
Dynamic: license-file

# pytest-intent

**The `@intent` decorator for pytest - links a test function to one or more CSD intent claims.**

> Published on PyPI as [`csd-pytest-intent`](https://pypi.org/project/csd-pytest-intent/) - the bare name `pytest-intent` belongs to an unrelated plugin there. The import name is `pytest_intent` either way.

> CSD (Cognitive Software Delivery) is a language-agnostic methodology. This package is one specific implementation, scoped to Python projects using pytest.

## What this package is

A tiny library (~40 LOC) that exposes a single decorator:

```python
from pytest_intent import intent

@intent("INT-001")
def test_resource_ids_unique(data_dir):
    ...

@intent("INT-021", "INT-022")  # one test serves two claims
def test_referential_integrity(data_dir):
    ...
```

That's the entire public surface.

## What it is NOT

- **Not a validator.** Schema checks (CSD-INTENT-01), orphan detection (test references unknown claim), and cross-runtime coverage all live in the standalone [`csd-intent`](https://github.com/PSA-Department-of-Engineering/csd-library/tree/main/csd-intent) CLI - point it at any project to audit.
- **Not a pytest plugin.** Just a decorator. No fixtures, no entry points, no autoloading. Drop the import in your tests and you're done.
- **Not a generator.** You write your tests; this annotates them.

## Why split the decorator from the auditor?

- **One concern per package.** The decorator runs inside pytest; the auditor is cross-language and runs standalone (CI step, pre-commit, ad-hoc).
- **No coupling.** Other test runners (vitest-intent, playwright-intent) expose the same `intent()` marker shape. The auditor reads all of them, regardless of which decorator package put the marker there.
- **Tiny install.** `pytest-intent` has no dependency on PyYAML or anything beyond pytest. The auditor pulls those in only when you actually need to audit.

## Install

```bash
# From PyPI (the distribution is csd-pytest-intent; the import stays pytest_intent):
pip install csd-pytest-intent

# Local dev against a csd-library checkout:
pip install -e path/to/csd-library/pytest-intent
```

## Companion: csd-intent

To validate your `intent.yaml` against CSD-INTENT-01 and check that every claim has a test:

```bash
pip install csd-intent
csd-intent /path/to/your/project
```

See [csd-intent README](../csd-intent/README.md) for full options.

## License

MIT.
