"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/console/commands/env/conftest.py" between
poetry-1.1.15.tar.gz and poetry-1.2.0.tar.gz

About: Poetry is a tool for dependency management and packaging in Python.

conftest.py  (poetry-1.1.15):conftest.py  (poetry-1.2.0)
from __future__ import annotations
import os import os
from pathlib import Path
from typing import TYPE_CHECKING
import pytest import pytest
from poetry.utils._compat import Path
from poetry.utils.env import EnvManager from poetry.utils.env import EnvManager
if TYPE_CHECKING:
from collections.abc import Iterator
from tests.helpers import PoetryTestApplication
@pytest.fixture @pytest.fixture
def venv_name(app): def venv_name(app: PoetryTestApplication) -> str:
return EnvManager.generate_env_name("simple-project", str(app.poetry.file.pa rent)) return EnvManager.generate_env_name("simple-project", str(app.poetry.file.pa rent))
@pytest.fixture @pytest.fixture
def venv_cache(tmp_dir): def venv_cache(tmp_dir: str) -> Path:
return Path(tmp_dir) return Path(tmp_dir)
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def python_versions(): def python_versions() -> list[str]:
return ["3.6", "3.7"] return ["3.6", "3.7"]
@pytest.fixture @pytest.fixture
def venvs_in_cache_config(app, venv_cache): def venvs_in_cache_config(app: PoetryTestApplication, venv_cache: Path) -> None:
app.poetry.config.merge({"virtualenvs": {"path": str(venv_cache)}}) app.poetry.config.merge({"virtualenvs": {"path": str(venv_cache)}})
@pytest.fixture @pytest.fixture
def venvs_in_cache_dirs( def venvs_in_cache_dirs(
app, venvs_in_cache_config, venv_name, venv_cache, python_versions app: PoetryTestApplication,
): venvs_in_cache_config: None,
venv_name: str,
venv_cache: Path,
python_versions: list[str],
) -> list[str]:
directories = [] directories = []
for version in python_versions: for version in python_versions:
directory = venv_cache.joinpath("{}-py{}".format(venv_name, version)) directory = venv_cache.joinpath(f"{venv_name}-py{version}")
directory.mkdir(parents=True, exist_ok=True) directory.mkdir(parents=True, exist_ok=True)
directories.append(directory.name) directories.append(directory.name)
return directories return directories
@pytest.fixture @pytest.fixture
def venvs_in_project_dir(app): def venvs_in_project_dir(app: PoetryTestApplication) -> Iterator[Path]:
os.environ.pop("VIRTUAL_ENV", None) os.environ.pop("VIRTUAL_ENV", None)
venv_dir = app.poetry.file.parent.joinpath(".venv") venv_dir = app.poetry.file.parent.joinpath(".venv")
venv_dir.mkdir(exist_ok=True) venv_dir.mkdir(exist_ok=True)
app.poetry.config.merge({"virtualenvs": {"in-project": True}}) app.poetry.config.merge({"virtualenvs": {"in-project": True}})
try: try:
yield venv_dir yield venv_dir
finally: finally:
venv_dir.rmdir() venv_dir.rmdir()
 End of changes. 11 change blocks. 
9 lines changed or deleted 22 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)