pytest-nunit is a pytest plugin for generating NUnit3 test result XML output. It integrates seamlessly with `pytest` to produce reports compatible with NUnit test runners. The project is actively maintained with frequent updates, including recent support for `pytest` 8 and ongoing compatibility improvements.
pip install pytest-nunitNo compatibility data collected yet for this library.
To use `pytest-nunit`, simply install the package. It integrates automatically with `pytest`. You can then generate an NUnit XML report by running `pytest` with the `--nunit-xml` option, specifying the desired output file path. This example demonstrates running tests and generating an XML report named `test-results.xml`.
Upgrade to `pytest-nunit` version 1.0.7 or later to ensure compatibility with `pytest` 8.x series.
Update `pytest-nunit` to version 1.0.6 or newer to use `datetime.now(timezone.utc)` and avoid `utcnow()` deprecation warnings.
Ensure `xmlschema` is installed alongside `pytest-nunit`. Typically `pip install pytest-nunit` handles this, but manual installation (`pip install xmlschema`) might be needed in isolated environments.
Always include `--nunit-xml=your_report_file.xml` when invoking `pytest` to ensure the report is generated.
Avoid using the `nunit_suite_name` INI option as it has no effect.
Add `looponfailroots = testdir` to your `pytest` configuration file (e.g., `pytest.ini`) to exclude XML report files from being watched by `pytest-xdist`'s looponfail feature.
Install the plugin using `pip install pytest-nunit` in your active virtual environment.
Provide a filename after `--nunitxml`, for example: `pytest --nunitxml=test_results.xml`.
You generally do not need to import `pytest_nunit`. To use the plugin, ensure it's installed (`pip install pytest-nunit`) and run `pytest` with the `--nunitxml` option.