diff --git a/dvc/testing/benchmarks/fixtures.py b/dvc/testing/benchmarks/fixtures.py index eb8c40acf..948e8078b 100644 --- a/dvc/testing/benchmarks/fixtures.py +++ b/dvc/testing/benchmarks/fixtures.py @@ -1,5 +1,6 @@ import os import shutil +from pathlib import Path from subprocess import check_output # nosec B404 import pytest @@ -48,7 +49,7 @@ def dvc_bench_git_repo(tmp_path_factory, bench_config): url = bench_config.dvc_bench_git_repo if os.path.isdir(url): - return url + return Path(url) tmp_path = tmp_path_factory.mktemp("dvc-bench-git-repo") clone(url, os.fspath(tmp_path)) @@ -70,9 +71,13 @@ def dvc_bin( if not venv: venv = make_dvc_venv(dvc_rev) venv.run("pip install -U pip") + if bench_config.dvc_install_deps: + egg = f"dvc[{bench_config.dvc_install_deps}]" + else: + egg = "dvc" + venv.run(f"pip install git+file://{dvc_git_repo}@{dvc_rev}#egg={egg}") if dvc_rev in ["2.18.1", "2.11.0", "2.6.3"]: venv.run("pip install fsspec==2022.11.0") - venv.run(f"pip install git+file://{dvc_git_repo}@{dvc_rev}") dvc_venvs[dvc_rev] = venv dvc_bin = venv.virtualenv / "bin" / "dvc" else: diff --git a/dvc/testing/benchmarks/plugin.py b/dvc/testing/benchmarks/plugin.py index 633456d57..54e5ebef4 100644 --- a/dvc/testing/benchmarks/plugin.py +++ b/dvc/testing/benchmarks/plugin.py @@ -17,6 +17,7 @@ class DVCBenchConfig: self.dvc_bin = DEFAULT_DVC_BIN self.dvc_revs = None self.dvc_git_repo = DEFAULT_DVC_GIT_REPO + self.dvc_install_deps = None self.dvc_bench_git_repo = DEFAULT_DVC_BENCH_GIT_REPO self.project_rev = None self.project_git_repo = DEFAULT_PROJECT_GIT_REPO @@ -29,6 +30,7 @@ def pytest_configure(config): config.bench_config.dvc_bin = config.getoption("--dvc-bin") config.bench_config.dvc_revs = config.getoption("--dvc-revs") config.bench_config.dvc_git_repo = config.getoption("--dvc-git-repo") + config.bench_config.dvc_install_deps = config.getoption("--dvc-install-deps") config.bench_config.dvc_bench_git_repo = config.getoption("--dvc-bench-git-repo") config.bench_config.project_rev = config.getoption("--project-rev") config.bench_config.project_git_repo = config.getoption("--project-git-repo") @@ -62,6 +64,13 @@ def pytest_addoption(parser): help="Path or url to dvc git repo", ) + parser.addoption( + "--dvc-install-deps", + type=str, + default="", + help="Comma-separated list of DVC installation packages", + ) + parser.addoption( "--dvc-bench-git-repo", type=str,