
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
pytest-repeat is a plugin for pytest <https://docs.pytest.org>
_ that makes it
easy to repeat a single test, or multiple tests, a specific number of times.
|license| |python| |version| |anaconda| |ci| |issues|
.. |license| image:: https://img.shields.io/badge/license-MPL%202.0-blue.svg :target: https://github.com/pytest-dev/pytest-repeat/blob/master/LICENSE
.. |version| image:: http://img.shields.io/pypi/v/pytest-repeat.svg :target: https://pypi.python.org/pypi/pytest-repeat
.. |anaconda| image:: https://img.shields.io/conda/vn/conda-forge/pytest-repeat.svg :target: https://anaconda.org/conda-forge/pytest-repeat
.. |ci| image:: https://github.com/pytest-dev/pytest-repeat/workflows/test/badge.svg :target: https://github.com/pytest-dev/pytest-repeat/actions
.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-repeat.svg :target: https://pypi.python.org/pypi/pytest-repeat/
.. |issues| image:: https://img.shields.io/github/issues-raw/pytest-dev/pytest-repeat.svg :target: https://github.com/pytest-dev/pytest-repeat/issues
You will need the following prerequisites in order to use pytest-repeat:
To install pytest-repeat:
.. code-block:: bash
$ pip install pytest-repeat
Use the :code:--count
command line option to specify how many times you want
your test, or tests, to be run:
.. code-block:: bash
$ pytest --count=10 test_file.py
Each test collected by pytest will be run :code:count
times.
If you want to mark a test in your code to be repeated a number of times, you
can use the :code:@pytest.mark.repeat(count)
decorator:
.. code-block:: python
import pytest
@pytest.mark.repeat(3) def test_repeat_decorator(): pass
If you want to override default tests executions order, you can use :code:--repeat-scope
command line option with one of the next values: :code:session
, :code:module
, :code:class
or :code:function
(default).
It behaves like a scope of the pytest fixture.
:code:function
(default) scope repeats each test :code:count
or :code:repeat
times before executing next test.
:code:session
scope repeats whole tests session, i.e. all collected tests executed once, then all such tests executed again and etc.
:code:class
and :code:module
behaves similar :code:session
, but repeating set of tests is a tests from class or module, not all collected tests.
If you are trying to diagnose an intermittent failure, it can be useful to run the same
test over and over again until it fails. You can use pytest's :code:-x
option in
conjunction with pytest-repeat to force the test runner to stop at the first failure.
For example:
.. code-block:: bash
$ pytest --count=1000 -x test_file.py
This will attempt to run test_file.py 1000 times, but will stop as soon as a failure occurs.
Unfortunately pytest-repeat is not able to work with unittest.TestCase test classes.
These tests will simply always run once, regardless of :code:--count
, and show a warning.
Release Notes <https://github.com/pytest-dev/pytest-repeat/blob/master/CHANGES.rst>
_Issue Tracker <https://github.com/pytest-dev/pytest-repeat/issues>
_Code <https://github.com/pytest-dev/pytest-repeat/>
_FAQs
pytest plugin for repeating tests
We found that pytest-repeat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.