pytest-rerunclassfailures


Namepytest-rerunclassfailures JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
Summarypytest rerun class failures plugin
upload_time2024-03-29 19:59:56
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Ilya Vereshchagin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords failures flacky pytest pytest-plugin pytest-rerunclassfailures qa testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pytest rerun class failures plugin


[![PyPI version](https://badge.fury.io/py/pytest-rerunclassfailures.svg)](https://badge.fury.io/py/pytest-rerunclassfailures) [![Linters](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml) [![Tests](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_tests.yml/badge.svg?branch=master)](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_tests.yml) [![Coverage Status](https://coveralls.io/repos/github/wwakabobik/pytest-rerunclassfailures/badge.svg?branch=master)](https://coveralls.io/github/wwakabobik/pytest-rerunclassfailures?branch=master) [![codecov](https://codecov.io/gh/wwakabobik/pytest-rerunclassfailures/graph/badge.svg?token=F1I7TBGE5U)](https://codecov.io/gh/wwakabobik/pytest-rerunclassfailures) ![PyPI - License](https://img.shields.io/pypi/l/pytest-rerunclassfailures) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-rerunclassfailures) [![Downloads](https://static.pepy.tech/badge/pytest-rerunclassfailures)](https://pepy.tech/project/pytest-rerunclassfailures) [![Downloads](https://static.pepy.tech/badge/pytest-rerunclassfailures/month)](https://pepy.tech/project/pytest-rerunclassfailures) 


This plugin helps to rerun whole test classes that failed during the test run.
This means in case of failure of any class within the test class, the whole class will be rerun. 
Due to that, in case of failure plugin will fail fast: 
the rest of the tests in class will be aborted and will not be run. 
Instead of that, all tests from the class will be rerun starting first one.
The plugin supports proper class teardown and reset attribute of the class to initial values. 
So it will be reset before each rerun.

![pytest-rerunclassfailures](https://raw.githubusercontent.com/wwakabobik/pytest-rerunclassfailures/master/assets/pytest-rerunclassfailures.jpg)

## Installation

You can install the plugin via pip:

```bash
pip install pytest-rerunclassfailures
```


## Usage

After installation plugin ready to use, you do not need to pass extra options or add plugin to `pytest.ini`. Just run your tests as usual:

```bash
pytest tests --rerun-class-max=2
```

You always need pass `--rerun-class-max` with number of reruns for the class. By default, the plugin is disabled.

Other options you may use:
- `--rerun-class-max` - number of reruns for the class. Default is 0.
- `--rerun-delay` - delay between reruns in seconds. Default is 0.5.
- `--rerun-show-only-last` - show only last rerun results (without 'reruns' in log), by default is not used.
- `--hide-rerun-details` - hide rerun details in the log ('RERUNS' section in terminal), by default is not used.

```bash
PYTHONPATH=. pytest -s tests -p pytest_rerunclassfailures --rerun-class-max=3 --rerun-delay=1 --rerun-show-only-last
```

In some cases you may manage plugins manually, so, you can do it in two ways:

- Run your tests with plugin by passing by `-p` option:
```bash
PYTHONPATH=. pytest -s tests -p pytest-rerunclassfailures --rerun-class-max=3
```
- Add plugin to `pytest.ini` file:

```ini
[pytest]
plugins = pytest-rerunclassfailures
addopts = --rerun-class-max=3
```

To disable plugin (even ignoring passed `--rerun-class-max` option) use:

```bash
pytest test -p no:pytest-rerunclassfailures
```

## pytest-xdist support

Plugin supports `pytest-xdist` plugin. 
It means that you can run tests in parallel and rerun failed classes in parallel as well.
But please note that every class tests method should schedule to run in the same worker. 
So the plugin can rerun the whole class in the same worker.
To do so, you need to run your tests with `--dist=loadscope` option. 
Otherwise, there's no guarantee that results will be predictable.


## Known limitations
- Please note, this plugin still not supports rerun of the class setup method. This means that if you use class-scoped fixtures, they will not be rerun, only class attributes will be reset to initial values.
- Due to `pytest-xdist` plugin limitations, report output will be thrown only when all tests in class are executed. This means that you will not see the output of the failed test until all tests in the class are rerun. Unfortunately, `pytest-xdist` plugin allows reporting results for only scheduled tests in scheduled order. Due to that, tests in class will be grouped by test, but not by rerun, as in regular run.
- Never use this plugin with `pytest-rerunfailures` plugin. It will not work as expected.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytest-rerunclassfailures",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Iliya Vereshchagin <i.vereshchagin@gmail.com>",
    "keywords": "failures, flacky, pytest, pytest-plugin, pytest-rerunclassfailures, qa, testing",
    "author": null,
    "author_email": "Iliya Vereshchagin <i.vereshchagin@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b9/bd/a3c55cf72b25ac83610a382add2fb4bafaf7705ae445c6946f19ed0f43d3/pytest_rerunclassfailures-0.1.0.tar.gz",
    "platform": null,
    "description": "# Pytest rerun class failures plugin\n\n\n[![PyPI version](https://badge.fury.io/py/pytest-rerunclassfailures.svg)](https://badge.fury.io/py/pytest-rerunclassfailures) [![Linters](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml/badge.svg?branch=master)](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_linters.yml) [![Tests](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_tests.yml/badge.svg?branch=master)](https://github.com/wwakabobik/pytest-rerunclassfailures/actions/workflows/master_tests.yml) [![Coverage Status](https://coveralls.io/repos/github/wwakabobik/pytest-rerunclassfailures/badge.svg?branch=master)](https://coveralls.io/github/wwakabobik/pytest-rerunclassfailures?branch=master) [![codecov](https://codecov.io/gh/wwakabobik/pytest-rerunclassfailures/graph/badge.svg?token=F1I7TBGE5U)](https://codecov.io/gh/wwakabobik/pytest-rerunclassfailures) ![PyPI - License](https://img.shields.io/pypi/l/pytest-rerunclassfailures) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytest-rerunclassfailures) [![Downloads](https://static.pepy.tech/badge/pytest-rerunclassfailures)](https://pepy.tech/project/pytest-rerunclassfailures) [![Downloads](https://static.pepy.tech/badge/pytest-rerunclassfailures/month)](https://pepy.tech/project/pytest-rerunclassfailures) \n\n\nThis plugin helps to rerun whole test classes that failed during the test run.\nThis means in case of failure of any class within the test class, the whole class will be rerun. \nDue to that, in case of failure plugin will fail fast: \nthe rest of the tests in class will be aborted and will not be run. \nInstead of that, all tests from the class will be rerun starting first one.\nThe plugin supports proper class teardown and reset attribute of the class to initial values. \nSo it will be reset before each rerun.\n\n![pytest-rerunclassfailures](https://raw.githubusercontent.com/wwakabobik/pytest-rerunclassfailures/master/assets/pytest-rerunclassfailures.jpg)\n\n## Installation\n\nYou can install the plugin via pip:\n\n```bash\npip install pytest-rerunclassfailures\n```\n\n\n## Usage\n\nAfter installation plugin ready to use, you do not need to pass extra options or add plugin to `pytest.ini`. Just run your tests as usual:\n\n```bash\npytest tests --rerun-class-max=2\n```\n\nYou always need pass `--rerun-class-max` with number of reruns for the class. By default, the plugin is disabled.\n\nOther options you may use:\n- `--rerun-class-max` - number of reruns for the class. Default is 0.\n- `--rerun-delay` - delay between reruns in seconds. Default is 0.5.\n- `--rerun-show-only-last` - show only last rerun results (without 'reruns' in log), by default is not used.\n- `--hide-rerun-details` - hide rerun details in the log ('RERUNS' section in terminal), by default is not used.\n\n```bash\nPYTHONPATH=. pytest -s tests -p pytest_rerunclassfailures --rerun-class-max=3 --rerun-delay=1 --rerun-show-only-last\n```\n\nIn some cases you may manage plugins manually, so, you can do it in two ways:\n\n- Run your tests with plugin by passing by `-p` option:\n```bash\nPYTHONPATH=. pytest -s tests -p pytest-rerunclassfailures --rerun-class-max=3\n```\n- Add plugin to `pytest.ini` file:\n\n```ini\n[pytest]\nplugins = pytest-rerunclassfailures\naddopts = --rerun-class-max=3\n```\n\nTo disable plugin (even ignoring passed `--rerun-class-max` option) use:\n\n```bash\npytest test -p no:pytest-rerunclassfailures\n```\n\n## pytest-xdist support\n\nPlugin supports `pytest-xdist` plugin. \nIt means that you can run tests in parallel and rerun failed classes in parallel as well.\nBut please note that every class tests method should schedule to run in the same worker. \nSo the plugin can rerun the whole class in the same worker.\nTo do so, you need to run your tests with `--dist=loadscope` option. \nOtherwise, there's no guarantee that results will be predictable.\n\n\n## Known limitations\n- Please note, this plugin still not supports rerun of the class setup method. This means that if you use class-scoped fixtures, they will not be rerun, only class attributes will be reset to initial values.\n- Due to `pytest-xdist` plugin limitations, report output will be thrown only when all tests in class are executed. This means that you will not see the output of the failed test until all tests in the class are rerun. Unfortunately, `pytest-xdist` plugin allows reporting results for only scheduled tests in scheduled order. Due to that, tests in class will be grouped by test, but not by rerun, as in regular run.\n- Never use this plugin with `pytest-rerunfailures` plugin. It will not work as expected.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Ilya Vereshchagin  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "pytest rerun class failures plugin",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/wwakabobik/pytest-rerunclassfailures/issues",
        "Homepage": "https://github.com/wwakabobik/pytest-rerunclassfailures"
    },
    "split_keywords": [
        "failures",
        " flacky",
        " pytest",
        " pytest-plugin",
        " pytest-rerunclassfailures",
        " qa",
        " testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e57ccc6ec8657b8b77e3a58a5423ce6bec2a53657911f44a64cfe28fc1b29632",
                "md5": "52fab7f44e8e5f342fd026b91fb0d555",
                "sha256": "d576c3494f87c897257db24cedc743e089117415a6c3f18cdda6f9bf75d2145b"
            },
            "downloads": -1,
            "filename": "pytest_rerunclassfailures-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "52fab7f44e8e5f342fd026b91fb0d555",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10046,
            "upload_time": "2024-03-29T19:59:53",
            "upload_time_iso_8601": "2024-03-29T19:59:53.933322Z",
            "url": "https://files.pythonhosted.org/packages/e5/7c/cc6ec8657b8b77e3a58a5423ce6bec2a53657911f44a64cfe28fc1b29632/pytest_rerunclassfailures-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9bda3c55cf72b25ac83610a382add2fb4bafaf7705ae445c6946f19ed0f43d3",
                "md5": "6ac57663c6843988293bba0c5c8a42d0",
                "sha256": "cbc93dbbe319554653d9e678451c360aa190813991ea6df619bd4f3d7738a5af"
            },
            "downloads": -1,
            "filename": "pytest_rerunclassfailures-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6ac57663c6843988293bba0c5c8a42d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 227160,
            "upload_time": "2024-03-29T19:59:56",
            "upload_time_iso_8601": "2024-03-29T19:59:56.994019Z",
            "url": "https://files.pythonhosted.org/packages/b9/bd/a3c55cf72b25ac83610a382add2fb4bafaf7705ae445c6946f19ed0f43d3/pytest_rerunclassfailures-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 19:59:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wwakabobik",
    "github_project": "pytest-rerunclassfailures",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pytest-rerunclassfailures"
}
        
Elapsed time: 0.23212s