Metadata-Version: 2.5
Name: pytest-otr
Version: 0.2.0
Summary: pytest plugin writing Open Test Reporting (OTR) XML reports
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Framework :: Pytest
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: pytest>=8.0
Provides-Extra: test
Requires-Dist: lxml>=5.0; extra == 'test'
Requires-Dist: pytest-xdist>=3.6; extra == 'test'
Description-Content-Type: text/markdown

# pytest-otr

pytest plugin that streams test results in the [Open Test Reporting (OTR)](
https://github.com/ota4j-team/open-test-reporting) event-based XML format,
maintained by the JUnit team.

## Usage

```
pytest --otr-report events.xml
```

Or stream events live to a consumer on 127.0.0.1 (e.g. a
[listener daemon](https://github.com/ota4j-team/open-test-reporting/#event-based-format)):

```
pytest --otr-socket 8080
```

Validate with the official CLI:

```
java -jar open-test-reporting-cli-0.2.7-standalone.jar validate events.xml
java -jar open-test-reporting-cli-0.2.7-standalone.jar html-report --output report.html events.xml
```

## Status mapping

| pytest outcome              | OTR status  | notes                          |
|-----------------------------|-------------|--------------------------------|
| passed                      | SUCCESSFUL  |                                |
| skipped                     | SKIPPED     | reason = skip reason           |
| failed (call)               | FAILED      | reason = longreprtext          |
| failed (setup/teardown)     | ERRORED     | reason = longreprtext          |
| xfail (failed as expected)  | SKIPPED     | reason = "xfail: ..."          |
| xpass (unexpected pass)     | FAILED      | reason = "XPASS: ..."          |
| xpass with `strict=True`    | FAILED      | reason = "[XPASS(strict)] ..." |
| collection error            | ABORTED     | container-level                |

Captured stdout/stderr of each test is attached as `<output>` elements
under `<attachments>`.

Hierarchy: root session → file container → class container → test.

## Known limitations

- Schema is still 0.2.x; output targets events-0.2.0.xsd.
- `--otr-socket` connects once at session start and fails with a warning
  (no report) if the consumer is not listening.

## Development

```
pip install -e ".[test]"
python -m pytest tests/
```

## License

Apache-2.0. OTR is a format specification of the JUnit team
(ota4j-team/open-test-reporting), Apache-2.0.
