Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry flaky tests #822

Closed
wants to merge 3 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def refresh_packages_cache(session):
def tests_with_options(session, net_pypiserver):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
prebuild_wheels(session, PREBUILD_PACKAGES)
session.install("-e", ".", "pytest", "pytest-cov")
session.install("-e", ".", "pytest", "pytest-cov", "pytest-rerunfailures")
tests = session.posargs or ["tests"]

if net_pypiserver:
Expand All @@ -114,7 +114,15 @@ def tests_with_options(session, net_pypiserver):
refresh_packages_cache(session)
pypiserver_option = []

session.run("pytest", *pypiserver_option, "--cov=pipx", "--cov-report=", *tests)
session.run(
"pytest",
*pypiserver_option,
"--cov=pipx",
"--cov-report=",
"--reruns=5",
"--reruns-delay=1",
*tests,
)
session.notify("cover")


Expand All @@ -133,7 +141,7 @@ def tests(session):
@nox.session(python=PYTHON_ALL_VERSIONS)
def test_all_packages(session):
session.run("python", "-m", "pip", "install", "--upgrade", "pip")
session.install("-e", ".", "pytest")
session.install("-e", ".", "pytest", "pytest-rerunfailures")
tests = session.posargs or ["tests"]
session.run(
"pytest",
Expand All @@ -142,6 +150,8 @@ def test_all_packages(session):
"--show-capture=no",
"--net-pypiserver",
"--all-packages",
"--reruns=5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this many? I’d start with 2.

Copy link
Sponsor Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

"--reruns-delay=1",
*tests,
)

Expand Down