pytest-exit-code 0.1.0__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pytest_exit_code-0.3.0/.github/dependabot.yml +13 -0
- pytest_exit_code-0.3.0/.github/workflows/release.yml +75 -0
- pytest_exit_code-0.3.0/.github/workflows/test.yml +77 -0
- pytest_exit_code-0.3.0/.gitignore +79 -0
- pytest_exit_code-0.3.0/PKG-INFO +87 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/README.md +18 -4
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/pyproject.toml +26 -9
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/src/pytest_exit_code/__init__.py +2 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/src/pytest_exit_code/plugin.py +15 -3
- pytest_exit_code-0.3.0/src/pytest_exit_code.egg-info/PKG-INFO +87 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/src/pytest_exit_code.egg-info/SOURCES.txt +8 -0
- pytest_exit_code-0.3.0/src/pytest_exit_code.egg-info/entry_points.txt +2 -0
- pytest_exit_code-0.3.0/src/pytest_exit_code.egg-info/requires.txt +1 -0
- pytest_exit_code-0.3.0/src/pytest_exit_code.egg-info/scm_file_list.json +16 -0
- pytest_exit_code-0.3.0/src/pytest_exit_code.egg-info/scm_version.json +8 -0
- pytest_exit_code-0.3.0/tests/conftest.py +1 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/tests/test_exit_code.py +34 -1
- pytest_exit_code-0.3.0/uv.lock +206 -0
- pytest-exit-code-0.1.0/PKG-INFO +0 -274
- pytest-exit-code-0.1.0/src/pytest_exit_code.egg-info/PKG-INFO +0 -274
- pytest-exit-code-0.1.0/src/pytest_exit_code.egg-info/entry_points.txt +0 -2
- pytest-exit-code-0.1.0/src/pytest_exit_code.egg-info/requires.txt +0 -1
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/LICENSE +0 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/setup.cfg +0 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/src/pytest_exit_code.egg-info/dependency_links.txt +0 -0
- {pytest-exit-code-0.1.0 → pytest_exit_code-0.3.0}/src/pytest_exit_code.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions: {}
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
with:
|
|
17
|
+
# setuptools-scm derives the version from the git tags.
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
persist-credentials: false
|
|
20
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
21
|
+
- name: Build a binary wheel and a source tarball
|
|
22
|
+
run: uv build
|
|
23
|
+
- name: Check that the built version matches the release tag
|
|
24
|
+
env:
|
|
25
|
+
TAG: ${{ github.ref_name }}
|
|
26
|
+
run: |
|
|
27
|
+
expected="${TAG#v}"
|
|
28
|
+
ls dist/
|
|
29
|
+
test -f "dist/pytest_exit_code-${expected}.tar.gz" || {
|
|
30
|
+
echo "::error::Built version does not match tag ${TAG} (expected ${expected})"
|
|
31
|
+
exit 1
|
|
32
|
+
}
|
|
33
|
+
- name: Store the distribution packages
|
|
34
|
+
uses: actions/upload-artifact@v7
|
|
35
|
+
with:
|
|
36
|
+
name: python-package-distributions
|
|
37
|
+
path: dist/
|
|
38
|
+
|
|
39
|
+
publish:
|
|
40
|
+
needs:
|
|
41
|
+
- build
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
environment:
|
|
44
|
+
name: pypi
|
|
45
|
+
url: https://pypi.org/p/pytest-exit-code
|
|
46
|
+
permissions:
|
|
47
|
+
# Required for PyPI trusted publishing and PEP 740 attestations.
|
|
48
|
+
id-token: write
|
|
49
|
+
steps:
|
|
50
|
+
- name: Download all the dists
|
|
51
|
+
uses: actions/download-artifact@v8
|
|
52
|
+
with:
|
|
53
|
+
name: python-package-distributions
|
|
54
|
+
path: dist/
|
|
55
|
+
- name: Publish distribution 📦 to PyPI
|
|
56
|
+
uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
|
|
57
|
+
|
|
58
|
+
release:
|
|
59
|
+
needs:
|
|
60
|
+
- publish
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
permissions:
|
|
63
|
+
contents: write
|
|
64
|
+
steps:
|
|
65
|
+
- name: Download all the dists
|
|
66
|
+
uses: actions/download-artifact@v8
|
|
67
|
+
with:
|
|
68
|
+
name: python-package-distributions
|
|
69
|
+
path: dist/
|
|
70
|
+
- name: Upload distributions to GitHub Release
|
|
71
|
+
env:
|
|
72
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
73
|
+
TAG: ${{ github.ref_name }}
|
|
74
|
+
REPO: ${{ github.repository }}
|
|
75
|
+
run: gh release upload "$TAG" dist/* --repo "$REPO"
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
lint:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v7
|
|
23
|
+
with:
|
|
24
|
+
persist-credentials: false
|
|
25
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
26
|
+
- name: Ruff check
|
|
27
|
+
run: uv run --locked ruff check
|
|
28
|
+
- name: Ruff format
|
|
29
|
+
run: uv run --locked ruff format --check
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
strategy:
|
|
34
|
+
fail-fast: false
|
|
35
|
+
matrix:
|
|
36
|
+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "pypy3.11"]
|
|
37
|
+
pytest-version: ["7", "8", "9"]
|
|
38
|
+
exclude:
|
|
39
|
+
# pytest 7 does not support Python 3.13 and newer.
|
|
40
|
+
- { python-version: "3.13", pytest-version: "7" }
|
|
41
|
+
- { python-version: "3.14", pytest-version: "7" }
|
|
42
|
+
- { python-version: "3.15", pytest-version: "7" }
|
|
43
|
+
name: test (Python ${{ matrix.python-version }}, pytest ${{ matrix.pytest-version }})
|
|
44
|
+
steps:
|
|
45
|
+
- uses: actions/checkout@v7
|
|
46
|
+
with:
|
|
47
|
+
persist-credentials: false
|
|
48
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
49
|
+
with:
|
|
50
|
+
python-version: ${{ matrix.python-version }}
|
|
51
|
+
- name: Install project
|
|
52
|
+
run: uv sync --locked
|
|
53
|
+
# uv.lock pins a single pytest version; override it in the venv to test
|
|
54
|
+
# each supported major version. --no-sync below keeps uv from reverting it.
|
|
55
|
+
- name: Install pytest ${{ matrix.pytest-version }}
|
|
56
|
+
run: uv pip install "pytest==${{ matrix.pytest-version }}.*"
|
|
57
|
+
- name: Test
|
|
58
|
+
run: |
|
|
59
|
+
uv run --no-sync pytest --version
|
|
60
|
+
uv run --no-sync pytest
|
|
61
|
+
|
|
62
|
+
test-lowest:
|
|
63
|
+
name: test (lowest supported dependencies)
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
steps:
|
|
66
|
+
- uses: actions/checkout@v7
|
|
67
|
+
with:
|
|
68
|
+
persist-credentials: false
|
|
69
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
70
|
+
with:
|
|
71
|
+
python-version: "3.10"
|
|
72
|
+
# Resolves the oldest versions allowed by pyproject.toml (pytest 7.0.0).
|
|
73
|
+
# --no-dev avoids installing ancient versions of the dev tools.
|
|
74
|
+
- name: Test
|
|
75
|
+
run: |
|
|
76
|
+
uv run --no-dev --resolution lowest-direct pytest --version
|
|
77
|
+
uv run --no-dev --resolution lowest-direct pytest
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
# Usually these files are written by a python script from a template
|
|
29
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
30
|
+
*.manifest
|
|
31
|
+
*.spec
|
|
32
|
+
|
|
33
|
+
# Installer logs
|
|
34
|
+
pip-log.txt
|
|
35
|
+
pip-delete-this-directory.txt
|
|
36
|
+
|
|
37
|
+
# Unit test / coverage reports
|
|
38
|
+
htmlcov/
|
|
39
|
+
.tox/
|
|
40
|
+
.coverage
|
|
41
|
+
.coverage.*
|
|
42
|
+
.cache
|
|
43
|
+
nosetests.xml
|
|
44
|
+
coverage.xml
|
|
45
|
+
*,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Django stuff:
|
|
54
|
+
*.log
|
|
55
|
+
local_settings.py
|
|
56
|
+
|
|
57
|
+
# Flask instance folder
|
|
58
|
+
instance/
|
|
59
|
+
|
|
60
|
+
# Sphinx documentation
|
|
61
|
+
docs/_build/
|
|
62
|
+
|
|
63
|
+
# MkDocs documentation
|
|
64
|
+
/site/
|
|
65
|
+
|
|
66
|
+
# PyBuilder
|
|
67
|
+
target/
|
|
68
|
+
|
|
69
|
+
# IPython Notebook
|
|
70
|
+
.ipynb_checkpoints
|
|
71
|
+
|
|
72
|
+
# pyenv
|
|
73
|
+
.python-version
|
|
74
|
+
|
|
75
|
+
# venv
|
|
76
|
+
.venv
|
|
77
|
+
|
|
78
|
+
# Editors
|
|
79
|
+
.vscode
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytest-exit-code
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A pytest plugin that overrides the built-in exit codes to retain more information about the test results.
|
|
5
|
+
Author-email: Sander Ploegsma <sanderploegsma@gmail.com>
|
|
6
|
+
Maintainer-email: Sander Ploegsma <sanderploegsma@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Repository, https://github.com/sanderploegsma/pytest-exit-code
|
|
9
|
+
Classifier: Framework :: Pytest
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Testing
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pytest>=7.0
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# pytest-exit-code [![PyPi version][pypi-version-badge]][pypi-project] [![Python versions][pypi-pyversions-badge]][pypi-project]
|
|
31
|
+
|
|
32
|
+
A [pytest] plugin that overrides the built-in exit codes to retain more information about the test results.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
This plugin changes the exit code returned by running `pytest`.
|
|
37
|
+
The exit codes can range from `0` to `63` and are a combination of the following bitwise flags:
|
|
38
|
+
|
|
39
|
+
| Flag | Description |
|
|
40
|
+
| ---- | ------------------------------- |
|
|
41
|
+
| `0` | All tests passed. |
|
|
42
|
+
| `1` | One or more tests passed. |
|
|
43
|
+
| `2` | One or more tests failed. |
|
|
44
|
+
| `4` | One or more tests errored. |
|
|
45
|
+
| `8` | One or more tests were skipped. |
|
|
46
|
+
| `16` | One or more tests xfailed. |
|
|
47
|
+
| `32` | One or more tests xpassed. |
|
|
48
|
+
|
|
49
|
+
So:
|
|
50
|
+
|
|
51
|
+
- An exit code of `2` means that all tests failed.
|
|
52
|
+
- An exit code of `6` means that all tests either failed or errored.
|
|
53
|
+
- An exit code of `7` indicates that the result contains a mix of passed, failed and errored tests.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
$ pip install pytest-exit-code
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Contributions are very welcome.
|
|
64
|
+
This project uses [uv] for development. Before you submit a pull request, please run the tests and linters:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
$ uv run pytest
|
|
68
|
+
$ uv run ruff check
|
|
69
|
+
$ uv run ruff format --check
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Releasing
|
|
73
|
+
|
|
74
|
+
The version is derived from the git tag by [setuptools-scm].
|
|
75
|
+
To release, create a GitHub Release with a new tag in the form `vX.Y.Z`; the release workflow builds the package and publishes it to PyPI.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
Distributed under the terms of the [Apache Software License 2.0] license, `pytest-exit-code` is free and open source software.
|
|
80
|
+
|
|
81
|
+
[Apache Software License 2.0]: https://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
[pypi-project]: https://pypi.org/project/pytest-exit-code
|
|
83
|
+
[pypi-version-badge]: https://img.shields.io/pypi/v/pytest-exit-code.svg
|
|
84
|
+
[pypi-pyversions-badge]: https://img.shields.io/pypi/pyversions/pytest-exit-code.svg
|
|
85
|
+
[pytest]: https://github.com/pytest-dev/pytest
|
|
86
|
+
[uv]: https://docs.astral.sh/uv/
|
|
87
|
+
[setuptools-scm]: https://setuptools-scm.readthedocs.io/
|
|
@@ -5,7 +5,7 @@ A [pytest] plugin that overrides the built-in exit codes to retain more informat
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
This plugin changes the exit code returned by running `pytest`.
|
|
8
|
-
The exit codes can range from `0` to `
|
|
8
|
+
The exit codes can range from `0` to `63` and are a combination of the following bitwise flags:
|
|
9
9
|
|
|
10
10
|
| Flag | Description |
|
|
11
11
|
| ---- | ------------------------------- |
|
|
@@ -14,6 +14,8 @@ The exit codes can range from `0` to `15` and are a combination of the following
|
|
|
14
14
|
| `2` | One or more tests failed. |
|
|
15
15
|
| `4` | One or more tests errored. |
|
|
16
16
|
| `8` | One or more tests were skipped. |
|
|
17
|
+
| `16` | One or more tests xfailed. |
|
|
18
|
+
| `32` | One or more tests xpassed. |
|
|
17
19
|
|
|
18
20
|
So:
|
|
19
21
|
|
|
@@ -24,13 +26,24 @@ So:
|
|
|
24
26
|
## Installation
|
|
25
27
|
|
|
26
28
|
```sh
|
|
27
|
-
$ pip install
|
|
29
|
+
$ pip install pytest-exit-code
|
|
28
30
|
```
|
|
29
31
|
|
|
30
32
|
## Contributing
|
|
31
33
|
|
|
32
34
|
Contributions are very welcome.
|
|
33
|
-
|
|
35
|
+
This project uses [uv] for development. Before you submit a pull request, please run the tests and linters:
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
$ uv run pytest
|
|
39
|
+
$ uv run ruff check
|
|
40
|
+
$ uv run ruff format --check
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Releasing
|
|
44
|
+
|
|
45
|
+
The version is derived from the git tag by [setuptools-scm].
|
|
46
|
+
To release, create a GitHub Release with a new tag in the form `vX.Y.Z`; the release workflow builds the package and publishes it to PyPI.
|
|
34
47
|
|
|
35
48
|
## License
|
|
36
49
|
|
|
@@ -41,4 +54,5 @@ Distributed under the terms of the [Apache Software License 2.0] license, `pytes
|
|
|
41
54
|
[pypi-version-badge]: https://img.shields.io/pypi/v/pytest-exit-code.svg
|
|
42
55
|
[pypi-pyversions-badge]: https://img.shields.io/pypi/pyversions/pytest-exit-code.svg
|
|
43
56
|
[pytest]: https://github.com/pytest-dev/pytest
|
|
44
|
-
[
|
|
57
|
+
[uv]: https://docs.astral.sh/uv/
|
|
58
|
+
[setuptools-scm]: https://setuptools-scm.readthedocs.io/
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=77", "setuptools-scm>=8"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pytest-exit-code"
|
|
7
7
|
description = "A pytest plugin that overrides the built-in exit codes to retain more information about the test results."
|
|
8
|
-
|
|
8
|
+
# Version is derived from the git tag (e.g. v0.3.0) by setuptools-scm.
|
|
9
|
+
dynamic = ["version"]
|
|
9
10
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
11
|
+
requires-python = ">=3.10"
|
|
11
12
|
authors = [{ name = "Sander Ploegsma", email = "sanderploegsma@gmail.com" }]
|
|
12
13
|
maintainers = [{ name = "Sander Ploegsma", email = "sanderploegsma@gmail.com" }]
|
|
13
|
-
license =
|
|
14
|
+
license = "Apache-2.0"
|
|
15
|
+
license-files = ["LICENSE"]
|
|
14
16
|
classifiers = [
|
|
15
17
|
"Framework :: Pytest",
|
|
16
18
|
"Development Status :: 4 - Beta",
|
|
@@ -18,20 +20,35 @@ classifiers = [
|
|
|
18
20
|
"Topic :: Software Development :: Testing",
|
|
19
21
|
"Operating System :: OS Independent",
|
|
20
22
|
"Programming Language :: Python",
|
|
21
|
-
"Programming Language :: Python :: 3.8",
|
|
22
|
-
"Programming Language :: Python :: 3.9",
|
|
23
23
|
"Programming Language :: Python :: 3.10",
|
|
24
24
|
"Programming Language :: Python :: 3.11",
|
|
25
25
|
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
|
+
"Programming Language :: Python :: 3.15",
|
|
26
29
|
"Programming Language :: Python :: 3 :: Only",
|
|
27
30
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
28
31
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
29
|
-
"License :: OSI Approved :: Apache Software License",
|
|
30
32
|
]
|
|
31
|
-
|
|
33
|
+
# pytest.StashKey (used by the plugin) was introduced in pytest 7.0.
|
|
34
|
+
dependencies = ["pytest>=7.0"]
|
|
32
35
|
|
|
33
36
|
[project.urls]
|
|
34
37
|
Repository = "https://github.com/sanderploegsma/pytest-exit-code"
|
|
35
38
|
|
|
36
39
|
[project.entry-points.pytest11]
|
|
37
|
-
|
|
40
|
+
exit_code = "pytest_exit_code.plugin"
|
|
41
|
+
|
|
42
|
+
[dependency-groups]
|
|
43
|
+
dev = ["pytest", "ruff"]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools_scm]
|
|
46
|
+
|
|
47
|
+
[tool.pytest.ini_options]
|
|
48
|
+
testpaths = ["tests"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
target-version = "py310"
|
|
52
|
+
|
|
53
|
+
[tool.ruff.lint]
|
|
54
|
+
extend-select = ["I", "UP", "B"]
|
|
@@ -9,10 +9,18 @@ class ExitCodePlugin:
|
|
|
9
9
|
def __init__(self) -> None:
|
|
10
10
|
self.exit_code = ExitCode.ALL_PASSED
|
|
11
11
|
|
|
12
|
+
@pytest.hookimpl
|
|
13
|
+
def pytest_collectreport(self, report: pytest.CollectReport) -> None:
|
|
14
|
+
if report.skipped:
|
|
15
|
+
self.exit_code |= ExitCode.TESTS_SKIPPED
|
|
16
|
+
|
|
12
17
|
@pytest.hookimpl
|
|
13
18
|
def pytest_runtest_logreport(self, report: pytest.TestReport) -> None:
|
|
14
19
|
if report.passed and report.when in ["call"]:
|
|
15
|
-
|
|
20
|
+
if hasattr(report, "wasxfail"):
|
|
21
|
+
self.exit_code |= ExitCode.TESTS_XPASSED
|
|
22
|
+
else:
|
|
23
|
+
self.exit_code |= ExitCode.TESTS_PASSED
|
|
16
24
|
|
|
17
25
|
if report.failed:
|
|
18
26
|
if report.when in ["setup", "teardown"]:
|
|
@@ -21,7 +29,10 @@ class ExitCodePlugin:
|
|
|
21
29
|
self.exit_code |= ExitCode.TESTS_FAILED
|
|
22
30
|
|
|
23
31
|
if report.skipped:
|
|
24
|
-
|
|
32
|
+
if hasattr(report, "wasxfail"):
|
|
33
|
+
self.exit_code |= ExitCode.TESTS_XFAILED
|
|
34
|
+
else:
|
|
35
|
+
self.exit_code |= ExitCode.TESTS_SKIPPED
|
|
25
36
|
|
|
26
37
|
@pytest.hookimpl
|
|
27
38
|
def pytest_sessionfinish(self, session: pytest.Session):
|
|
@@ -34,7 +45,8 @@ class ExitCodePlugin:
|
|
|
34
45
|
def pytest_configure(config: pytest.Config) -> None:
|
|
35
46
|
plugin = ExitCodePlugin()
|
|
36
47
|
config.stash[stash_key] = plugin
|
|
37
|
-
|
|
48
|
+
# Must not clash with the "exit_code" entry-point name in pyproject.toml.
|
|
49
|
+
config.pluginmanager.register(plugin, "exit_code_plugin")
|
|
38
50
|
|
|
39
51
|
|
|
40
52
|
def pytest_unconfigure(config: pytest.Config) -> None:
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pytest-exit-code
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A pytest plugin that overrides the built-in exit codes to retain more information about the test results.
|
|
5
|
+
Author-email: Sander Ploegsma <sanderploegsma@gmail.com>
|
|
6
|
+
Maintainer-email: Sander Ploegsma <sanderploegsma@gmail.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
Project-URL: Repository, https://github.com/sanderploegsma/pytest-exit-code
|
|
9
|
+
Classifier: Framework :: Pytest
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Topic :: Software Development :: Testing
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
21
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
22
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: pytest>=7.0
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# pytest-exit-code [![PyPi version][pypi-version-badge]][pypi-project] [![Python versions][pypi-pyversions-badge]][pypi-project]
|
|
31
|
+
|
|
32
|
+
A [pytest] plugin that overrides the built-in exit codes to retain more information about the test results.
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
This plugin changes the exit code returned by running `pytest`.
|
|
37
|
+
The exit codes can range from `0` to `63` and are a combination of the following bitwise flags:
|
|
38
|
+
|
|
39
|
+
| Flag | Description |
|
|
40
|
+
| ---- | ------------------------------- |
|
|
41
|
+
| `0` | All tests passed. |
|
|
42
|
+
| `1` | One or more tests passed. |
|
|
43
|
+
| `2` | One or more tests failed. |
|
|
44
|
+
| `4` | One or more tests errored. |
|
|
45
|
+
| `8` | One or more tests were skipped. |
|
|
46
|
+
| `16` | One or more tests xfailed. |
|
|
47
|
+
| `32` | One or more tests xpassed. |
|
|
48
|
+
|
|
49
|
+
So:
|
|
50
|
+
|
|
51
|
+
- An exit code of `2` means that all tests failed.
|
|
52
|
+
- An exit code of `6` means that all tests either failed or errored.
|
|
53
|
+
- An exit code of `7` indicates that the result contains a mix of passed, failed and errored tests.
|
|
54
|
+
|
|
55
|
+
## Installation
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
$ pip install pytest-exit-code
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Contributions are very welcome.
|
|
64
|
+
This project uses [uv] for development. Before you submit a pull request, please run the tests and linters:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
$ uv run pytest
|
|
68
|
+
$ uv run ruff check
|
|
69
|
+
$ uv run ruff format --check
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Releasing
|
|
73
|
+
|
|
74
|
+
The version is derived from the git tag by [setuptools-scm].
|
|
75
|
+
To release, create a GitHub Release with a new tag in the form `vX.Y.Z`; the release workflow builds the package and publishes it to PyPI.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
Distributed under the terms of the [Apache Software License 2.0] license, `pytest-exit-code` is free and open source software.
|
|
80
|
+
|
|
81
|
+
[Apache Software License 2.0]: https://www.apache.org/licenses/LICENSE-2.0
|
|
82
|
+
[pypi-project]: https://pypi.org/project/pytest-exit-code
|
|
83
|
+
[pypi-version-badge]: https://img.shields.io/pypi/v/pytest-exit-code.svg
|
|
84
|
+
[pypi-pyversions-badge]: https://img.shields.io/pypi/pyversions/pytest-exit-code.svg
|
|
85
|
+
[pytest]: https://github.com/pytest-dev/pytest
|
|
86
|
+
[uv]: https://docs.astral.sh/uv/
|
|
87
|
+
[setuptools-scm]: https://setuptools-scm.readthedocs.io/
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
.gitignore
|
|
1
2
|
LICENSE
|
|
2
3
|
README.md
|
|
3
4
|
pyproject.toml
|
|
5
|
+
uv.lock
|
|
6
|
+
.github/dependabot.yml
|
|
7
|
+
.github/workflows/release.yml
|
|
8
|
+
.github/workflows/test.yml
|
|
4
9
|
src/pytest_exit_code/__init__.py
|
|
5
10
|
src/pytest_exit_code/plugin.py
|
|
6
11
|
src/pytest_exit_code.egg-info/PKG-INFO
|
|
@@ -8,5 +13,8 @@ src/pytest_exit_code.egg-info/SOURCES.txt
|
|
|
8
13
|
src/pytest_exit_code.egg-info/dependency_links.txt
|
|
9
14
|
src/pytest_exit_code.egg-info/entry_points.txt
|
|
10
15
|
src/pytest_exit_code.egg-info/requires.txt
|
|
16
|
+
src/pytest_exit_code.egg-info/scm_file_list.json
|
|
17
|
+
src/pytest_exit_code.egg-info/scm_version.json
|
|
11
18
|
src/pytest_exit_code.egg-info/top_level.txt
|
|
19
|
+
tests/conftest.py
|
|
12
20
|
tests/test_exit_code.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest>=7.0
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".github/dependabot.yml",
|
|
4
|
+
".github/workflows/release.yml",
|
|
5
|
+
".github/workflows/test.yml",
|
|
6
|
+
".gitignore",
|
|
7
|
+
"LICENSE",
|
|
8
|
+
"README.md",
|
|
9
|
+
"pyproject.toml",
|
|
10
|
+
"src/pytest_exit_code/__init__.py",
|
|
11
|
+
"src/pytest_exit_code/plugin.py",
|
|
12
|
+
"tests/conftest.py",
|
|
13
|
+
"tests/test_exit_code.py",
|
|
14
|
+
"uv.lock"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pytest_plugins = "pytester"
|