From 708587a159991ffde2946b970c964d38968521fc Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Tue, 4 May 2021 11:22:57 +0545 Subject: [PATCH] tests: mark test_stash_pop as xfail on linux (#5952) I tried increasing max_run to very high number: 1000. Even in those cases, it failed 947 times. So I don't really see a reason to mark it as flaky. Anyway, we are treating it as xfail by keeping it failing in the CI, so this PR does not change anything for us. :) --- tests/func/test_scm.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/func/test_scm.py b/tests/func/test_scm.py index b9dafa312..0229f25ee 100644 --- a/tests/func/test_scm.py +++ b/tests/func/test_scm.py @@ -1,7 +1,7 @@ import os +import sys import pytest -from flaky.flaky_decorator import flaky from git import Repo from dvc.scm import SCM, Git, NoSCM @@ -243,10 +243,22 @@ def test_git_stash_drop(tmp_dir, scm, ref): assert len(stash) == 1 -# libgit2 stash_save() is flaky on linux when run inside pytest, see: -# https://github.com/iterative/dvc/pull/5286#issuecomment-792574294 -@flaky(max_runs=5, min_passes=1) -@pytest.mark.parametrize("ref", [None, "refs/foo/stash"]) +reason = """libgit2 stash_save() is flaky on linux when run inside pytest + https://github.com/iterative/dvc/pull/5286#issuecomment-792574294""" + + +@pytest.mark.parametrize( + "ref", + [ + pytest.param( + None, + marks=pytest.mark.xfail( + sys.platform == "linux", raises=AssertionError, reason=reason, + ), + ), + "refs/foo/stash", + ], +) def test_git_stash_pop(tmp_dir, scm, ref): from dvc.scm.git import Stash