From 46c734eb7e7abd53b155d33bae80499beb23e9e2 Mon Sep 17 00:00:00 2001 From: Peter Rowlands Date: Tue, 22 Feb 2022 18:40:21 +0900 Subject: [PATCH] exp: temporarily mark tmpdir/queue tests as xfail --- tests/func/experiments/conftest.py | 12 ++++++++++++ tests/func/experiments/test_checkpoints.py | 9 +-------- tests/func/experiments/test_experiments.py | 20 +++++++++----------- tests/func/experiments/test_gc.py | 4 ++++ tests/func/experiments/test_remove.py | 3 +++ tests/func/experiments/test_show.py | 4 +++- 6 files changed, 32 insertions(+), 20 deletions(-) diff --git a/tests/func/experiments/conftest.py b/tests/func/experiments/conftest.py index 67c025802..872a71b50 100644 --- a/tests/func/experiments/conftest.py +++ b/tests/func/experiments/conftest.py @@ -102,3 +102,15 @@ def http_auth_patch(mocker): patch = mocker.patch("dulwich.client.get_transport_and_path") patch.return_value = (client, url) return url + + +@pytest.fixture( + params=[ + True, + pytest.param( + False, marks=pytest.mark.xfail(reason="celery tests disabled") + ), + ] +) +def workspace(request) -> bool: + return request.param diff --git a/tests/func/experiments/test_checkpoints.py b/tests/func/experiments/test_checkpoints.py index 014ad97c3..50675b21f 100644 --- a/tests/func/experiments/test_checkpoints.py +++ b/tests/func/experiments/test_checkpoints.py @@ -13,7 +13,6 @@ from dvc.repo.experiments.utils import exp_refs_by_rev from dvc.scm import InvalidRemoteSCMRepo -@pytest.mark.parametrize("workspace", [True, False]) @pytest.mark.parametrize("links", ["reflink,copy", "hardlink,symlink"]) def test_new_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, mocker, workspace, links @@ -47,10 +46,7 @@ def test_new_checkpoint( assert (tmp_dir / "metrics.yaml").read_text().strip() == "foo: 2" -@pytest.mark.parametrize( - "checkpoint_resume, workspace", - [(None, True), (None, False), ("foo", True), ("foo", False)], -) +@pytest.mark.parametrize("checkpoint_resume", [None, "foo"]) def test_resume_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, checkpoint_resume, workspace ): @@ -91,7 +87,6 @@ def test_resume_checkpoint( assert scm.get_ref(EXEC_CHECKPOINT) == exp -@pytest.mark.parametrize("workspace", [True, False]) def test_reset_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, caplog, workspace ): @@ -122,7 +117,6 @@ def test_reset_checkpoint( assert scm.get_ref(EXEC_CHECKPOINT) == exp -@pytest.mark.parametrize("workspace", [True, False]) def test_resume_branch(tmp_dir, scm, dvc, checkpoint_stage, workspace): results = dvc.experiments.run( checkpoint_stage.addressing, params=["foo=2"], tmp_dir=not workspace @@ -173,7 +167,6 @@ def test_resume_branch(tmp_dir, scm, dvc, checkpoint_stage, workspace): ) -@pytest.mark.parametrize("workspace", [True, False]) def test_resume_non_head_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, workspace ): diff --git a/tests/func/experiments/test_experiments.py b/tests/func/experiments/test_experiments.py index a3742a4c3..98e39c163 100644 --- a/tests/func/experiments/test_experiments.py +++ b/tests/func/experiments/test_experiments.py @@ -16,10 +16,7 @@ from dvc.utils.serialize import PythonFileCorruptedError from tests.func.test_repro_multistage import COPY_SCRIPT -@pytest.mark.parametrize( - "name,workspace", - [(None, True), (None, False), ("foo", True), ("foo", False)], -) +@pytest.mark.parametrize("name", [None, "foo"]) def test_new_simple(tmp_dir, scm, dvc, exp_stage, mocker, name, workspace): baseline = scm.get_rev() tmp_dir.gen("params.yaml", "foo: 2") @@ -45,7 +42,6 @@ def test_new_simple(tmp_dir, scm, dvc, exp_stage, mocker, name, workspace): assert resolve_rev(scm, exp_name) == exp -@pytest.mark.parametrize("workspace", [True, False]) def test_experiment_exists(tmp_dir, scm, dvc, exp_stage, mocker, workspace): from dvc.repo.experiments.exceptions import ExperimentExistsError @@ -92,6 +88,7 @@ def test_file_permissions(tmp_dir, scm, dvc, exp_stage, mocker): assert stat.S_IMODE(os.stat(tmp_dir / "copy.py").st_mode) == mode +@pytest.mark.xfail(reason="celery tests disabled") def test_failed_exp(tmp_dir, scm, dvc, exp_stage, mocker, caplog): from dvc.exceptions import ReproductionError @@ -172,6 +169,7 @@ 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 @@ -237,6 +235,7 @@ def test_apply_untracked(tmp_dir, scm, dvc, exp_stage): assert (tmp_dir / "params.yaml").read_text().strip() == "foo: 2" +@pytest.mark.xfail(reason="celery tests disabled") def test_get_baseline(tmp_dir, scm, dvc, exp_stage): from dvc.repo.experiments.refs import EXPS_STASH @@ -261,10 +260,10 @@ def test_get_baseline(tmp_dir, scm, dvc, exp_stage): dvc.experiments.run(exp_stage.addressing, params=["foo=5"], queue=True) assert dvc.experiments.get_baseline(f"{EXPS_STASH}@{{0}}") == promote_rev - print("stash 1") 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") @@ -427,7 +426,7 @@ def test_no_scm(tmp_dir): getattr(dvc.experiments, cmd)() -@pytest.mark.parametrize("workspace", [True, False]) +@pytest.mark.xfail(reason="celery tests disabled") def test_untracked(tmp_dir, scm, dvc, caplog, workspace): tmp_dir.gen("copy.py", COPY_SCRIPT) tmp_dir.scm_gen("params.yaml", "foo: 1", commit="track params") @@ -506,7 +505,6 @@ def test_list(tmp_dir, scm, dvc, exp_stage): } -@pytest.mark.parametrize("workspace", [True, False]) def test_subdir(tmp_dir, scm, dvc, workspace): subdir = tmp_dir / "dir" subdir.gen("copy.py", COPY_SCRIPT) @@ -543,7 +541,6 @@ def test_subdir(tmp_dir, scm, dvc, workspace): assert resolve_rev(scm, ref_info.name) == exp -@pytest.mark.parametrize("workspace", [True, False]) def test_subrepo(tmp_dir, scm, workspace): from dvc.testing.tmp_dir import make_subrepo @@ -588,6 +585,7 @@ def test_subrepo(tmp_dir, scm, workspace): assert resolve_rev(scm, ref_info.name) == exp +@pytest.mark.xfail(reason="celery tests disabled") def test_queue(tmp_dir, scm, dvc, exp_stage, mocker): dvc.experiments.run(exp_stage.addressing, params=["foo=2"], queue=True) dvc.experiments.run(exp_stage.addressing, params=["foo=3"], queue=True) @@ -655,8 +653,8 @@ def test_fix_exp_head(tmp_dir, scm, tail): @pytest.mark.parametrize( - "workspace, params, target", - itertools.product((True, False), ("foo: 1", "foo: 2"), (True, False)), + "params, target", + itertools.product(("foo: 1", "foo: 2"), (True, False)), ) def test_modified_data_dep(tmp_dir, scm, dvc, workspace, params, target): tmp_dir.dvc_gen("data", "data") diff --git a/tests/func/experiments/test_gc.py b/tests/func/experiments/test_gc.py index e5f9069ca..4507f51c3 100644 --- a/tests/func/experiments/test_gc.py +++ b/tests/func/experiments/test_gc.py @@ -4,6 +4,7 @@ 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) @@ -25,6 +26,7 @@ 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) @@ -54,6 +56,7 @@ 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) @@ -90,6 +93,7 @@ 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 a519f3edd..1c6e605ef 100644 --- a/tests/func/experiments/test_remove.py +++ b/tests/func/experiments/test_remove.py @@ -32,6 +32,7 @@ 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 = [] @@ -52,6 +53,7 @@ def test_remove_all_queued_experiments(tmp_dir, scm, dvc, exp_stage): 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" @@ -86,6 +88,7 @@ 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))) diff --git a/tests/func/experiments/test_show.py b/tests/func/experiments/test_show.py index 8ec268aa4..370f0bea8 100644 --- a/tests/func/experiments/test_show.py +++ b/tests/func/experiments/test_show.py @@ -104,6 +104,7 @@ def test_show_experiment(tmp_dir, scm, dvc, exp_stage, workspace): @pytest.mark.vscode +@pytest.mark.xfail(reason="celery tests disabled") def test_show_queued(tmp_dir, scm, dvc, exp_stage): baseline_rev = scm.get_rev() @@ -364,6 +365,7 @@ def test_show_running_workspace(tmp_dir, scm, dvc, exp_stage, capsys): assert info.location in cap.out +@pytest.mark.xfail(reason="celery tests disabled") def test_show_running_executor(tmp_dir, scm, dvc, exp_stage): baseline_rev = scm.get_rev() dvc.experiments.run(exp_stage.addressing, params=["foo=2"], queue=True) @@ -388,7 +390,7 @@ def test_show_running_executor(tmp_dir, scm, dvc, exp_stage): assert not results["workspace"]["baseline"]["data"]["running"] -@pytest.mark.parametrize("workspace", [True, False]) +@pytest.mark.xfail(reason="celery tests disabled") def test_show_running_checkpoint( tmp_dir, scm, dvc, checkpoint_stage, workspace, mocker ):