pytest-flakefighters 0.0.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.
Files changed (47) hide show
  1. pytest_flakefighters-0.0.0/.github/workflows/ci-mega-linter.yml +36 -0
  2. pytest_flakefighters-0.0.0/.github/workflows/ci-tests-drafts.yaml +37 -0
  3. pytest_flakefighters-0.0.0/.github/workflows/ci-tests.yaml +42 -0
  4. pytest_flakefighters-0.0.0/.gitignore +211 -0
  5. pytest_flakefighters-0.0.0/.mega-linter.yaml +14 -0
  6. pytest_flakefighters-0.0.0/.pre-commit-config.yaml +21 -0
  7. pytest_flakefighters-0.0.0/LICENSE +22 -0
  8. pytest_flakefighters-0.0.0/PKG-INFO +116 -0
  9. pytest_flakefighters-0.0.0/README.md +63 -0
  10. pytest_flakefighters-0.0.0/docs/Makefile +192 -0
  11. pytest_flakefighters-0.0.0/docs/conf.py +289 -0
  12. pytest_flakefighters-0.0.0/docs/index.rst +21 -0
  13. pytest_flakefighters-0.0.0/docs/make.bat +263 -0
  14. pytest_flakefighters-0.0.0/pyproject.toml +97 -0
  15. pytest_flakefighters-0.0.0/setup.cfg +4 -0
  16. pytest_flakefighters-0.0.0/src/pytest_flakefighters/__init__.py +0 -0
  17. pytest_flakefighters-0.0.0/src/pytest_flakefighters/database_management.py +231 -0
  18. pytest_flakefighters-0.0.0/src/pytest_flakefighters/flakefighters/__init__.py +0 -0
  19. pytest_flakefighters-0.0.0/src/pytest_flakefighters/flakefighters/abstract_flakefighter.py +50 -0
  20. pytest_flakefighters-0.0.0/src/pytest_flakefighters/flakefighters/coverage_independence.py +99 -0
  21. pytest_flakefighters-0.0.0/src/pytest_flakefighters/flakefighters/deflaker.py +126 -0
  22. pytest_flakefighters-0.0.0/src/pytest_flakefighters/flakefighters/traceback_matching.py +171 -0
  23. pytest_flakefighters-0.0.0/src/pytest_flakefighters/function_coverage.py +71 -0
  24. pytest_flakefighters-0.0.0/src/pytest_flakefighters/main.py +162 -0
  25. pytest_flakefighters-0.0.0/src/pytest_flakefighters/plugin.py +225 -0
  26. pytest_flakefighters-0.0.0/src/pytest_flakefighters/rerun_strategies.py +90 -0
  27. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/PKG-INFO +116 -0
  28. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/SOURCES.txt +45 -0
  29. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/dependency_links.txt +1 -0
  30. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/entry_points.txt +8 -0
  31. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/requires.txt +20 -0
  32. pytest_flakefighters-0.0.0/src/pytest_flakefighters.egg-info/top_level.txt +1 -0
  33. pytest_flakefighters-0.0.0/tests/__init__.py +0 -0
  34. pytest_flakefighters-0.0.0/tests/conftest.py +67 -0
  35. pytest_flakefighters-0.0.0/tests/flakefighters/test_coverage_independence.py +126 -0
  36. pytest_flakefighters-0.0.0/tests/flakefighters/test_deflaker.py +199 -0
  37. pytest_flakefighters-0.0.0/tests/flakefighters/test_traceback_matching.py +140 -0
  38. pytest_flakefighters-0.0.0/tests/resources/deflaker_broken.py +16 -0
  39. pytest_flakefighters-0.0.0/tests/resources/deflaker_example.py +16 -0
  40. pytest_flakefighters-0.0.0/tests/resources/flaky_reruns.py +22 -0
  41. pytest_flakefighters-0.0.0/tests/resources/pass_fail_flaky.py +15 -0
  42. pytest_flakefighters-0.0.0/tests/resources/test.txt +0 -0
  43. pytest_flakefighters-0.0.0/tests/resources/triangle.py +31 -0
  44. pytest_flakefighters-0.0.0/tests/test_database_management.py +131 -0
  45. pytest_flakefighters-0.0.0/tests/test_end_2_end.py +96 -0
  46. pytest_flakefighters-0.0.0/tests/test_function_coverage.py +80 -0
  47. pytest_flakefighters-0.0.0/tests/test_rerun_strategies.py +138 -0
@@ -0,0 +1,36 @@
1
+ name: Linting and formatting
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ concurrency:
9
+ group: ${{ github.ref }}-${{ github.workflow }}
10
+ cancel-in-progress: true
11
+
12
+ jobs:
13
+ build:
14
+ name: MegaLinter
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: write
18
+ pull-requests: write
19
+ steps:
20
+ - name: Checkout Code
21
+ uses: actions/checkout@v2
22
+
23
+ - name: MegaLinter
24
+ id: ml
25
+ uses: oxsecurity/megalinter/flavors/python@latest
26
+ env:
27
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For detailed check status
28
+
29
+ - name: Archive production artifacts
30
+ if: ${{ success() }} || ${{ failure() }}
31
+ uses: actions/upload-artifact@v4
32
+ with:
33
+ name: MegaLinter reports
34
+ path: |
35
+ megalinter-reports
36
+ mega-linter.log
@@ -0,0 +1,37 @@
1
+ name: Continuous Integration Tests Draft PR (pytest)
2
+ # This duplicate ci workflow is required so the badge in the README.md is not effected by draft PRs
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ build:
10
+ if: github.event.pull_request.draft == true
11
+ name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ matrix:
15
+ os: ["ubuntu-latest", "windows-latest", "macos-latest"]
16
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ - name: Install dependencies
24
+ run: |
25
+ python --version
26
+ python -m pip install --upgrade pip
27
+ pip install -e .
28
+ pip install -e .[test]
29
+ pip install pytest pytest-cov
30
+ - name: Test with pytest
31
+ run: |
32
+ pytest -p no:flakefighters --cov=src --cov-report=xml
33
+ - name: "Upload coverage to Codecov"
34
+ uses: codecov/codecov-action@v5
35
+ with:
36
+ fail_ci_if_error: true
37
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,42 @@
1
+ name: Continuous Integration Tests (pytest)
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ types:
8
+ - opened
9
+ - synchronize
10
+ - reopened
11
+ - ready_for_review
12
+
13
+ jobs:
14
+ build:
15
+ if: github.event.pull_request.draft == false # Filter out draft PRs
16
+ name: Ex1 (${{ matrix.python-version }}, ${{ matrix.os }})
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ matrix:
20
+ os: ["ubuntu-latest", "windows-latest", "macos-latest"]
21
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ - name: Install dependencies
29
+ run: |
30
+ python --version
31
+ python -m pip install --upgrade pip
32
+ pip install -e .
33
+ pip install -e .[test]
34
+ pip install pytest pytest-cov
35
+ - name: Test with pytest
36
+ run: |
37
+ pytest -p no:flakefighters --cov=src --cov-report=xml
38
+ - name: "Upload coverage to Codecov"
39
+ uses: codecov/codecov-action@v5
40
+ with:
41
+ fail_ci_if_error: true
42
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,211 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+
209
+ megalinter-reports/
210
+
211
+ *.db
@@ -0,0 +1,14 @@
1
+ # Configuration file for MegaLinter
2
+ # See all available variables at https://oxsecurity.github.io/megalinter/configuration/ and in linters documentation
3
+
4
+ ENABLE_LINTERS:
5
+ - PYTHON_PYLINT
6
+ - PYTHON_BLACK
7
+
8
+ GITHUB_STATUS_REPORTER: true
9
+
10
+ FILTER_REGEX_INCLUDE: (src/|tests/)
11
+ FILTER_REGEX_EXCLUDE: (tests/resources/)
12
+
13
+ APPLY_FIXES: all
14
+ PYTHON_PYLINT_CONFIG_FILE: pyproject.toml
@@ -0,0 +1,21 @@
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos:
4
+ - repo: https://github.com/PyCQA/isort
5
+ rev: 6.0.1 # Use the latest version
6
+ hooks:
7
+ - id: isort
8
+ - repo: https://github.com/ambv/black
9
+ rev: 25.1.0
10
+ hooks:
11
+ - id: black
12
+ language_version: python3.11
13
+ - repo: local
14
+ hooks:
15
+ - id: pylint
16
+ name: pylint
17
+ entry: pylint
18
+ language: system
19
+ types: [python]
20
+ args: ['--max-line-length=120', '--max-positional-arguments=12']
21
+ files: ^src/|^tests/
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) 2025 TestFLARE Team
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-flakefighters
3
+ Version: 0.0.0
4
+ Summary: Pytest plugin implementing flaky test failure detection and classification.
5
+ Author: TestFLARE Team
6
+ License:
7
+ The MIT License (MIT)
8
+
9
+ Copyright (c) 2025 TestFLARE Team
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in
19
+ all copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27
+ THE SOFTWARE.
28
+
29
+ Project-URL: Repository, https://github.com/test-flare/pytest-flakefighter
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: pytest>=6.2.0
34
+ Requires-Dist: coverage>=7.10.6
35
+ Requires-Dist: GitPython>=3.1.45
36
+ Requires-Dist: unidiff>=0.7.5
37
+ Requires-Dist: sqlalchemy>=2.0.43
38
+ Requires-Dist: dotenv>=0.9.9
39
+ Requires-Dist: pandas
40
+ Requires-Dist: scipy<=1.15
41
+ Requires-Dist: pyyaml>=6
42
+ Requires-Dist: scikit-learn>=1.7
43
+ Requires-Dist: nltk>=3.9
44
+ Provides-Extra: dev
45
+ Requires-Dist: black; extra == "dev"
46
+ Requires-Dist: pytest-cov; extra == "dev"
47
+ Requires-Dist: pylint; extra == "dev"
48
+ Requires-Dist: pre_commit; extra == "dev"
49
+ Requires-Dist: sphinx-autoapi; extra == "dev"
50
+ Requires-Dist: sphinx_rtd_theme; extra == "dev"
51
+ Requires-Dist: tox>=4.31.0; extra == "dev"
52
+ Dynamic: license-file
53
+
54
+ # Pytest FlakeFighters
55
+
56
+ [![PyPI version](https://img.shields.io/pypi/v/pytest-flakefighters.svg)](https://pypi.org/project/pytest-flakefighters)
57
+ [![Python versions](https://img.shields.io/pypi/pyversions/pytest-flakefighters.svg)](https://pypi.org/project/pytest-flakefighters)
58
+
59
+ Pytest plugin implementing flaky test failure detection and
60
+ classification.
61
+
62
+ ------------------------------------------------------------------------
63
+
64
+ This [pytest](https://github.com/pytest-dev/pytest) plugin was generated with [Cookiecutter](https://github.com/audreyr/cookiecutter) along with [\@hackebrot](https://github.com/hackebrot)\'s [cookiecutter-pytest-plugin](https://github.com/pytest-dev/cookiecutter-pytest-plugin) template.
65
+
66
+ ## Features
67
+
68
+ - Implements the [DeFlaker algorithm](https://deflaker.com/) for pytest
69
+
70
+
71
+ ## Installation
72
+
73
+ You can install \"pytest-flakefighters\" by cloning this repo and running `pip install .` from the root directory.
74
+ If you intend to develop the plugin, run `pip install -e .[dev]` instead.
75
+
76
+ We eventually intend to distribute our tool on PyPI.
77
+
78
+ ## Usage
79
+
80
+ FlakeFighter is intended to run on git repositories that have test suites runnable with `pytest`.
81
+ Once you have installed FlakeFighter, you can run it from the root directory of your repo simply by running `pytest` in your usual way.
82
+ FlakeFighter has the following arguments.
83
+
84
+ ```
85
+ --target-commit=TARGET_COMMIT
86
+ The target (newer) commit hash. Defaults to HEAD (the most recent commit).
87
+ --source-commit=SOURCE_COMMIT
88
+ The source (older) commit hash. Defaults to HEAD^ (the previous commit to target).
89
+ --repo=REPO_ROOT The commit hash to compare against.
90
+ --suppress-flaky-failures-exit-code
91
+ Return OK exit code if the only failures are flaky failures.
92
+ --no-save Do not save this run to the database of previous flakefighters runs.
93
+ -M LOAD_MAX_RUNS, --load-max-runs=LOAD_MAX_RUNS
94
+ The maximum number of previous runs to consider.
95
+ -D DATABASE_URL, --database-url=DATABASE_URL
96
+ The database URL. Defaults to 'flakefighter.db' in current working directory.
97
+ --store-max-runs=STORE_MAX_RUNS
98
+ The maximum number of previous flakefighters runs to store. Default is to store all.
99
+ --time-immemorial=TIME_IMMEMORIAL
100
+ How long to store flakefighters runs for, specified as `days:hours:minutes`. E.g. to store
101
+ tests for one week, use 7:0:0.
102
+ ```
103
+
104
+ ## Contributing
105
+
106
+ Contributions are very welcome.
107
+ Tests can be run with [pytest](https://pytest.readthedocs.io/en/latest/), please ensure the coverage at least stays the same before you submit a pull request.
108
+
109
+ ## Flake Fighters
110
+ Our plugin is made up of a collection of heuristics that come together to help inform whether a test failure is genuine or flaky.
111
+ These come in two "flavours": those which run live after each test, and those which run at the end of the entire test suite.
112
+ Both extend the base class `FlakeFighter` and implement the `flaky_failure` method, which returns `True` if the test is deemed to be flaky.
113
+
114
+ ## Issues
115
+
116
+ If you encounter any problems, please [file an issue](https://github.com/test-flare/pytest-flakefighters/issues) along with a detailed description.
@@ -0,0 +1,63 @@
1
+ # Pytest FlakeFighters
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/pytest-flakefighters.svg)](https://pypi.org/project/pytest-flakefighters)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/pytest-flakefighters.svg)](https://pypi.org/project/pytest-flakefighters)
5
+
6
+ Pytest plugin implementing flaky test failure detection and
7
+ classification.
8
+
9
+ ------------------------------------------------------------------------
10
+
11
+ This [pytest](https://github.com/pytest-dev/pytest) plugin was generated with [Cookiecutter](https://github.com/audreyr/cookiecutter) along with [\@hackebrot](https://github.com/hackebrot)\'s [cookiecutter-pytest-plugin](https://github.com/pytest-dev/cookiecutter-pytest-plugin) template.
12
+
13
+ ## Features
14
+
15
+ - Implements the [DeFlaker algorithm](https://deflaker.com/) for pytest
16
+
17
+
18
+ ## Installation
19
+
20
+ You can install \"pytest-flakefighters\" by cloning this repo and running `pip install .` from the root directory.
21
+ If you intend to develop the plugin, run `pip install -e .[dev]` instead.
22
+
23
+ We eventually intend to distribute our tool on PyPI.
24
+
25
+ ## Usage
26
+
27
+ FlakeFighter is intended to run on git repositories that have test suites runnable with `pytest`.
28
+ Once you have installed FlakeFighter, you can run it from the root directory of your repo simply by running `pytest` in your usual way.
29
+ FlakeFighter has the following arguments.
30
+
31
+ ```
32
+ --target-commit=TARGET_COMMIT
33
+ The target (newer) commit hash. Defaults to HEAD (the most recent commit).
34
+ --source-commit=SOURCE_COMMIT
35
+ The source (older) commit hash. Defaults to HEAD^ (the previous commit to target).
36
+ --repo=REPO_ROOT The commit hash to compare against.
37
+ --suppress-flaky-failures-exit-code
38
+ Return OK exit code if the only failures are flaky failures.
39
+ --no-save Do not save this run to the database of previous flakefighters runs.
40
+ -M LOAD_MAX_RUNS, --load-max-runs=LOAD_MAX_RUNS
41
+ The maximum number of previous runs to consider.
42
+ -D DATABASE_URL, --database-url=DATABASE_URL
43
+ The database URL. Defaults to 'flakefighter.db' in current working directory.
44
+ --store-max-runs=STORE_MAX_RUNS
45
+ The maximum number of previous flakefighters runs to store. Default is to store all.
46
+ --time-immemorial=TIME_IMMEMORIAL
47
+ How long to store flakefighters runs for, specified as `days:hours:minutes`. E.g. to store
48
+ tests for one week, use 7:0:0.
49
+ ```
50
+
51
+ ## Contributing
52
+
53
+ Contributions are very welcome.
54
+ Tests can be run with [pytest](https://pytest.readthedocs.io/en/latest/), please ensure the coverage at least stays the same before you submit a pull request.
55
+
56
+ ## Flake Fighters
57
+ Our plugin is made up of a collection of heuristics that come together to help inform whether a test failure is genuine or flaky.
58
+ These come in two "flavours": those which run live after each test, and those which run at the end of the entire test suite.
59
+ Both extend the base class `FlakeFighter` and implement the `flaky_failure` method, which returns `True` if the test is deemed to be flaky.
60
+
61
+ ## Issues
62
+
63
+ If you encounter any problems, please [file an issue](https://github.com/test-flare/pytest-flakefighters/issues) along with a detailed description.