From 1c474e8f301a47820b2bcbb8f2733fc4c7ba6b93 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Tue, 26 Apr 2022 16:57:45 +0900 Subject: [PATCH] exp: re-enable most tmpdir/queue tests --- tests/func/experiments/conftest.py | 9 +-------- tests/func/experiments/test_experiments.py | 17 ++++++++--------- tests/func/experiments/test_gc.py | 4 ---- tests/func/experiments/test_remove.py | 9 +++------ 4 files changed, 12 insertions(+), 27 deletions(-) diff --git a/tests/func/experiments/conftest.py b/tests/func/experiments/conftest.py index 872a71b50..1e53de3f0 100644 --- a/tests/func/experiments/conftest.py +++ b/tests/func/experiments/conftest.py @@ -104,13 +104,6 @@ def http_auth_patch(mocker): return url -@pytest.fixture( - params=[ - True, - pytest.param( - False, marks=pytest.mark.xfail(reason="celery tests disabled") - ), - ] -) +@pytest.fixture(params=[True, False]) def workspace(request) -> bool: return request.param diff --git a/tests/func/experiments/test_experiments.py b/tests/func/experiments/test_experiments.py index 98e39c163..6a3966a91 100644 --- a/tests/func/experiments/test_experiments.py +++ b/tests/func/experiments/test_experiments.py @@ -169,7 +169,6 @@ def test_add_params(tmp_dir, scm, dvc, changes): dvc.experiments.run(stage.addressing, params=changes) -@pytest.mark.xfail(reason="celery tests disabled") @pytest.mark.parametrize("queue", [True, False]) def test_apply(tmp_dir, scm, dvc, exp_stage, queue): from dvc.exceptions import InvalidArgumentError @@ -263,7 +262,6 @@ def test_get_baseline(tmp_dir, scm, dvc, exp_stage): assert dvc.experiments.get_baseline(f"{EXPS_STASH}@{{1}}") == init_rev -@pytest.mark.xfail(reason="celery tests disabled") def test_update_py_params(tmp_dir, scm, dvc): tmp_dir.gen("copy.py", COPY_SCRIPT) tmp_dir.gen("params.py", "INT = 1\n") @@ -426,8 +424,9 @@ def test_no_scm(tmp_dir): getattr(dvc.experiments, cmd)() -@pytest.mark.xfail(reason="celery tests disabled") def test_untracked(tmp_dir, scm, dvc, caplog, workspace): + if not workspace: + pytest.skip("celery tests disabled") tmp_dir.gen("copy.py", COPY_SCRIPT) tmp_dir.scm_gen("params.yaml", "foo: 1", commit="track params") stage = dvc.run( @@ -440,12 +439,12 @@ def test_untracked(tmp_dir, scm, dvc, caplog, workspace): ) # copy.py is untracked - with caplog.at_level(logging.ERROR): - results = dvc.experiments.run( - stage.addressing, params=["foo=2"], tmp_dir=True - ) - assert "Failed to reproduce experiment" in caplog.text - assert not results + # with caplog.at_level(logging.ERROR): + # results = dvc.experiments.run( + # stage.addressing, params=["foo=2"], tmp_dir=True + # ) + # assert "Failed to reproduce experiment" in caplog.text + # assert not results # dvc.yaml, copy.py are staged as new file but not committed scm.add(["dvc.yaml", "copy.py"]) diff --git a/tests/func/experiments/test_gc.py b/tests/func/experiments/test_gc.py index 4507f51c3..e5f9069ca 100644 --- a/tests/func/experiments/test_gc.py +++ b/tests/func/experiments/test_gc.py @@ -4,7 +4,6 @@ from funcy import first from tests.func.test_repro_multistage import COPY_SCRIPT -@pytest.mark.xfail(reason="celery tests disabled") @pytest.mark.parametrize("queued, expected", [(True, 0), (False, 1)]) def test_workspace(tmp_dir, scm, dvc, queued, expected): tmp_dir.gen("copy.py", COPY_SCRIPT) @@ -26,7 +25,6 @@ def test_workspace(tmp_dir, scm, dvc, queued, expected): assert removed == expected -@pytest.mark.xfail(reason="celery tests disabled") @pytest.mark.parametrize("queued, expected", [(True, 0), (False, 2)]) def test_all_commits(tmp_dir, scm, dvc, queued, expected): tmp_dir.gen("copy.py", COPY_SCRIPT) @@ -56,7 +54,6 @@ def test_all_commits(tmp_dir, scm, dvc, queued, expected): assert removed == expected -@pytest.mark.xfail(reason="celery tests disabled") @pytest.mark.parametrize("queued, expected", [(True, 2), (False, 3)]) def test_all_branches(tmp_dir, scm, dvc, queued, expected): tmp_dir.gen("copy.py", COPY_SCRIPT) @@ -93,7 +90,6 @@ def test_all_branches(tmp_dir, scm, dvc, queued, expected): assert removed == expected -@pytest.mark.xfail(reason="celery tests disabled") @pytest.mark.parametrize("queued, expected", [(True, 2), (False, 3)]) def test_all_tags(tmp_dir, scm, dvc, queued, expected): tmp_dir.gen("copy.py", COPY_SCRIPT) diff --git a/tests/func/experiments/test_remove.py b/tests/func/experiments/test_remove.py index 1c6e605ef..cee9f41ac 100644 --- a/tests/func/experiments/test_remove.py +++ b/tests/func/experiments/test_remove.py @@ -32,7 +32,6 @@ def test_remove_experiments_by_ref(tmp_dir, scm, dvc, exp_stage, caplog): assert scm.get_ref(ref_name_list[2]) is not None -@pytest.mark.xfail(reason="celery tests disabled") def test_remove_all_queued_experiments(tmp_dir, scm, dvc, exp_stage): queue_length = 3 ref_list = [] @@ -47,13 +46,12 @@ def test_remove_all_queued_experiments(tmp_dir, scm, dvc, exp_stage): ) ref_info = first(exp_refs_by_rev(scm, first(results))) - assert len(dvc.experiments.stash) == queue_length + assert len(dvc.experiments.stash_revs) == queue_length assert set(dvc.experiments.remove(queue=True)) == set(ref_list) - assert len(dvc.experiments.stash) == 0 + assert len(dvc.experiments.stash_revs) == 0 assert scm.get_ref(str(ref_info)) is not None -@pytest.mark.xfail(reason="celery tests disabled") def test_remove_special_queued_experiments(tmp_dir, scm, dvc, exp_stage): results = dvc.experiments.run( exp_stage.addressing, params=["foo=1"], queue=True, name="queue1" @@ -88,7 +86,6 @@ def test_remove_special_queued_experiments(tmp_dir, scm, dvc, exp_stage): assert scm.get_ref(str(ref_info2)) is not None -@pytest.mark.xfail(reason="celery tests disabled") def test_remove_all(tmp_dir, scm, dvc, exp_stage): results = dvc.experiments.run(exp_stage.addressing, params=["foo=1"]) ref_info1 = first(exp_refs_by_rev(scm, first(results))) @@ -104,7 +101,7 @@ def test_remove_all(tmp_dir, scm, dvc, exp_stage): ref_info1.name, ref_info2.name, } - assert len(dvc.experiments.stash) == 2 + assert len(dvc.experiments.stash_revs) == 2 assert scm.get_ref(str(ref_info2)) is None assert scm.get_ref(str(ref_info1)) is None