exp: re-enable most tmpdir/queue tests

This commit is contained in:
Peter Rowlands
2022-07-12 21:39:49 +09:00
committed by Peter Rowlands (변기호)
parent 24654fe16c
commit 1c474e8f30
4 changed files with 12 additions and 27 deletions
+1 -8
View File
@@ -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
+8 -9
View File
@@ -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"])
-4
View File
@@ -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)
+3 -6
View File
@@ -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