From 5c10b8d54ac1d759b2793142cadb202fdd617891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Fri, 4 Aug 2023 08:09:53 +0545 Subject: [PATCH] fix flaky test for repro --keep-going and --ignore --- tests/func/repro/test_repro.py | 42 ++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/tests/func/repro/test_repro.py b/tests/func/repro/test_repro.py index d31fd23436..551e70527c 100644 --- a/tests/func/repro/test_repro.py +++ b/tests/func/repro/test_repro.py @@ -1326,14 +1326,18 @@ def test_repro_keep_going(mocker, tmp_dir, dvc, copy_script): with pytest.raises(ReproductionError): dvc.reproduce(on_error="keep-going", repro_fn=spy) - assert spy.call_args_list == [ - mocker.call(bar_stage, upstream=[], force=False, interactive=False), - mocker.call(stage1, upstream=[bar_stage], force=False, interactive=False), - mocker.call(foo_stage, upstream=[], force=False, interactive=False), - ] + bar_call = mocker.call(bar_stage, upstream=[], force=False, interactive=False) + stage1_call = mocker.call( + stage1, upstream=[bar_stage], force=False, interactive=False + ) + foo_call = mocker.call(foo_stage, upstream=[], force=False, interactive=False) + assert spy.call_args_list in ( + [bar_call, stage1_call, foo_call], + [foo_call, bar_call, stage1_call], + ) -def test_repro_ignore_errors(M, mocker, tmp_dir, dvc, copy_script): +def test_repro_ignore_errors(mocker, tmp_dir, dvc, copy_script): from dvc.repo import reproduce (bar_stage, foo_stage) = tmp_dir.dvc_gen({"bar": "bar", "foo": "foo"}) @@ -1347,14 +1351,18 @@ def test_repro_ignore_errors(M, mocker, tmp_dir, dvc, copy_script): spy = mocker.spy(reproduce, "_reproduce_stage") dvc.reproduce(on_error="ignore", repro_fn=spy) - assert spy.call_args_list == [ - mocker.call(bar_stage, upstream=[], force=False, interactive=False), - mocker.call(stage1, upstream=[bar_stage], force=False, interactive=False), - mocker.call(foo_stage, upstream=[], force=False, interactive=False), - mocker.call( - stage2, - upstream=[foo_stage, stage1], - force=False, - interactive=False, - ), - ] + bar_call = mocker.call(bar_stage, upstream=[], force=False, interactive=False) + foo_call = mocker.call(foo_stage, upstream=[], force=False, interactive=False) + stage1_call = mocker.call( + stage1, upstream=[bar_stage], force=False, interactive=False + ) + stage2_call = mocker.call( + stage2, + upstream=[foo_stage, stage1], + force=False, + interactive=False, + ) + assert spy.call_args_list in ( + [bar_call, stage1_call, foo_call, stage2_call], + [foo_call, bar_call, stage1_call, stage2_call], + )