remove pytest-virtualenv (#10103)

* remove pytest-virtualenv

It does not look like it's being actively maintained.

* force virtualenv

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
skshetry
2023-11-23 14:53:39 +05:45
committed by GitHub
co-authored by pre-commit-ci[bot]
parent 3d7bbb8492
commit fbdb566079
2 changed files with 31 additions and 13 deletions
+28 -7
View File
@@ -2,26 +2,47 @@ import os
import shutil
from pathlib import Path
from subprocess import check_output
from typing import Dict, Optional
import pytest
import virtualenv
from dulwich.porcelain import clone
from funcy import first
from packaging import version
from dvc.types import StrPath
@pytest.fixture(scope="session")
def bench_config(request):
return request.config.bench_config
class VirtualEnv:
def __init__(self, path: StrPath) -> None:
self.path = Path(path)
self.bin = self.path / ("Scripts" if os.name == "nt" else "bin")
def create(self) -> None:
virtualenv.cli_run([os.fspath(self.path)])
def run(self, cmd: str, *args: str, env: Optional[Dict[str, str]] = None) -> None:
exe = self.which(cmd)
check_output([exe, *args], env=env) # noqa: S603
def which(self, cmd: str) -> str:
assert self.bin.exists()
return shutil.which(cmd, path=self.bin) or cmd
@pytest.fixture(scope="session")
def make_dvc_venv(tmp_path_factory):
def _make_dvc_venv(name):
from pytest_virtualenv import VirtualEnv
name = _sanitize_venv_name(name)
venv_dir = tmp_path_factory.mktemp(f"dvc-venv-{name}")
return VirtualEnv(workspace=venv_dir)
venv = VirtualEnv(venv_dir)
venv.create()
return venv
return _make_dvc_venv
@@ -74,16 +95,16 @@ def make_dvc_bin(
venv = dvc_venvs.get(dvc_rev)
if not venv:
venv = make_dvc_venv(dvc_rev)
venv.run("pip install -U pip")
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}")
venv.run("pip", "install", f"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("pip", "install", "fsspec==2022.11.0")
dvc_venvs[dvc_rev] = venv
dvc_bin = venv.virtualenv / "bin" / "dvc"
dvc_bin = venv.which("dvc")
else:
dvc_bin = bench_config.dvc_bin
+3 -6
View File
@@ -90,9 +90,9 @@ s3 = ["dvc-s3==2.23.0"]
ssh = ["dvc-ssh>=2.22.1,<3"]
ssh_gssapi = ["dvc-ssh[gssapi]>=2.22.1,<3"]
testing = [
"pytest-test-utils",
"pytest-benchmark[histogram]",
"pytest-virtualenv",
"pytest-test-utils",
"virtualenv",
]
tests = [
"dvc[testing]",
@@ -156,8 +156,6 @@ filterwarnings = [
# google.logging: https://github.com/googleapis/python-logging/issues/730
# Also happens with `zc.lockfile`.
"ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning",
# tpi imports pkg_resources
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
# see https://github.com/networkx/networkx/issues/5723.
"ignore:nx.nx_pydot.* depends on the pydot package, which has.*known issues and is not actively maintained:DeprecationWarning",
]
@@ -230,12 +228,11 @@ module = [
"pyparsing",
"pytest_benchmark.*",
"pytest_docker.plugin",
"pytest_virtualenv.*",
"ruamel.*",
"ruamel.yaml.*",
"shortuuid",
"shtab",
"tpi.*",
"virtualenv",
"viztracer",
"voluptuous",
"yappi",