From b243ccab1fc6108c2ed5c4c0d481558238c4d777 Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:10:58 +0545 Subject: [PATCH] tests: remove pytest-lazy-fixture (#10294) Since it's no longer being maintained. See https://github.com/TvoroG/pytest-lazy-fixture/issues/65. --- pyproject.toml | 1 - tests/func/test_data_cloud.py | 7 +++---- tests/func/test_get.py | 14 ++++++-------- tests/func/test_ls.py | 10 ++++++---- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 58a28af0d2..d666043a54 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -106,7 +106,6 @@ tests = [ "pytest<8,>=7", "pytest-cov>=4.1.0", "pytest-docker>=1,<4", - "pytest-lazy-fixture", "pytest-mock", "pytest-test-utils", "pytest-timeout>=2", diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 57473114dc..e885c3d385 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -208,10 +208,9 @@ def test_verify_hashes(tmp_dir, scm, dvc, mocker, tmp_path_factory, local_remote @flaky(max_runs=3, min_passes=1) -@pytest.mark.parametrize( - "erepo", [pytest.lazy_fixture("git_dir"), pytest.lazy_fixture("erepo_dir")] -) -def test_pull_git_imports(tmp_dir, dvc, scm, erepo): +@pytest.mark.parametrize("erepo_type", ["git_dir", "erepo_dir"]) +def test_pull_git_imports(request, tmp_dir, dvc, scm, erepo_type): + erepo = request.getfixturevalue(erepo_type) with erepo.chdir(): erepo.scm_gen({"dir": {"bar": "bar"}}, commit="second") erepo.scm_gen("foo", "foo", commit="first") diff --git a/tests/func/test_get.py b/tests/func/test_get.py index 6b76dbddf9..0ee50f6fa1 100644 --- a/tests/func/test_get.py +++ b/tests/func/test_get.py @@ -80,13 +80,12 @@ def test_get_repo_broken_dir(tmp_dir, erepo_dir): assert not (tmp_dir / "out").exists() -@pytest.mark.parametrize( - "erepo", [pytest.lazy_fixture("git_dir"), pytest.lazy_fixture("erepo_dir")] -) -def test_get_git_file(tmp_dir, erepo): +@pytest.mark.parametrize("erepo_type", ["git_dir", "erepo_dir"]) +def test_get_git_file(request, tmp_dir, erepo_type): src = "some_file" dst = "some_file_imported" + erepo = request.getfixturevalue(erepo_type) erepo.scm_gen({src: "hello"}, commit="add a regular file") Repo.get(os.fspath(erepo), src, dst) @@ -94,13 +93,12 @@ def test_get_git_file(tmp_dir, erepo): assert (tmp_dir / dst).read_text() == "hello" -@pytest.mark.parametrize( - "erepo", [pytest.lazy_fixture("git_dir"), pytest.lazy_fixture("erepo_dir")] -) -def test_get_git_dir(tmp_dir, erepo): +@pytest.mark.parametrize("erepo_type", ["git_dir", "erepo_dir"]) +def test_get_git_dir(request, tmp_dir, erepo_type): src = "some_directory" dst = "some_directory_imported" + erepo = request.getfixturevalue(erepo_type) erepo.scm_gen({src: {"dir": {"file.txt": "hello"}}}, commit="add a regular dir") Repo.get(os.fspath(erepo), src, dst) diff --git a/tests/func/test_ls.py b/tests/func/test_ls.py index 7429ac3cf6..1a2806c7fa 100644 --- a/tests/func/test_ls.py +++ b/tests/func/test_ls.py @@ -518,17 +518,19 @@ def _ls(path): @pytest.mark.parametrize( - "dvc_top_level, erepo", + "dvc_top_level, erepo_type", [ - (True, pytest.lazy_fixture("erepo_dir")), - (False, pytest.lazy_fixture("git_dir")), + (True, "erepo_dir"), + (False, "git_dir"), ], ) -def test_subrepo(dvc_top_level, erepo): +def test_subrepo(request, dvc_top_level, erepo_type): from tests.func.test_get import make_subrepo dvc_files = {"foo.txt": "foo.txt", "dvc_dir": {"lorem": "lorem"}} scm_files = {"bar.txt": "bar.txt", "scm_dir": {"ipsum": "ipsum"}} + + erepo = request.getfixturevalue(erepo_type) subrepo = erepo / "subrepo" make_subrepo(subrepo, erepo.scm)