pytest-repeat | pytest plugin for repeating test execution | Plugin library
kandi X-RAY | pytest-repeat Summary
kandi X-RAY | pytest-repeat Summary
pytest plugin for repeating test execution
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of pytest-repeat
pytest-repeat Key Features
pytest-repeat Examples and Code Snippets
Community Discussions
Trending Discussions on pytest-repeat
QUESTION
I've minimized my problem to a self-contained flask app + unit test. When this is run with pytest app.py
it fails roughly half the time (29 out of 50 runs) with this error:
ANSWER
Answered 2018-Jun-25 at 08:28If you add db.session.refresh(t)
in post()
after commit, it will solve the problem. I don't know whether it's a right thing to do so (SQLAlchemy is quite complicated and I had a little experience with it), but it shows that a t
-object state sometimes is not refreshed (sometimes because probably there is a race condition and sometimes SQLAlchemy maybe gets more machine time and pulls id just in time, but sometimes is not) after a commit and id
-attribute still somehow doesn't exist (I mean, for flask, because for sqlite it does exist, but a new state is not pulled from a DB).
QUESTION
There is the module pytest-repeat which can be used to repeat the execution of pytest N times (the whole test suite).
However, I want to, upon an AssertionError, re-run that specific test again, instead of running the whole suit. So, how can I capture the AssertionError and programmatically call the same test function?
...ANSWER
Answered 2018-Jun-18 at 12:19The flaky
package provides a @flaky
decorator. From the documentation:
QUESTION
I am trying to run a pytest method multiple times using pytest-repeat but i am getting a warning and its running only once
...ANSWER
Answered 2018-Jun-05 at 08:14 @pytest.mark.run(order=1)
def test_registerLink(self):
for i in range(100):
self.rg.register()
self.rg.select_state_name()
self.rg.select_city_name()
self.rg.select_ready_wait()
self.rg.select_ready_pay()
self.rg.select_submit()
self.rg.driver.back()
self.rg.driver.refresh()
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pytest-repeat
You can use pytest-repeat like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page