"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/console/commands/env/test_list.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.

test_list.py  (poetry-1.1.15):test_list.py  (poetry-1.2.0)
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest import pytest
import tomlkit import tomlkit
from poetry.core.toml.file import TOMLFile from poetry.core.toml.file import TOMLFile
from pathlib import Path
from cleo.testers.command_tester import CommandTester
from pytest_mock import MockerFixture
from poetry.utils.env import MockEnv
from tests.types import CommandTesterFactory
@pytest.fixture @pytest.fixture
def venv_activate_37(venv_cache, venv_name): def venv_activate_37(venv_cache: Path, venv_name: str) -> None:
envs_file = TOMLFile(venv_cache / "envs.toml") envs_file = TOMLFile(venv_cache / "envs.toml")
doc = tomlkit.document() doc = tomlkit.document()
doc[venv_name] = {"minor": "3.7", "patch": "3.7.0"} doc[venv_name] = {"minor": "3.7", "patch": "3.7.0"}
envs_file.write(doc) envs_file.write(doc)
@pytest.fixture @pytest.fixture
def tester(command_tester_factory): def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
return command_tester_factory("env list") return command_tester_factory("env list")
def test_none_activated(tester, venvs_in_cache_dirs, mocker, env): def test_none_activated(
tester: CommandTester,
venvs_in_cache_dirs: list[str],
mocker: MockerFixture,
env: MockEnv,
mocker.patch("poetry.utils.env.EnvManager.get", return_value=env) mocker.patch("poetry.utils.env.EnvManager.get", return_value=env)
tester.execute() tester.execute()
expected = "\n".join(venvs_in_cache_dirs).strip() expected = "\n".join(venvs_in_cache_dirs).strip()
assert expected == tester.io.fetch_output().strip() assert tester.io.fetch_output().strip() == expected
def test_activated(tester, venvs_in_cache_dirs, venv_cache, venv_activate_37): def test_activated(
tester: CommandTester,
venvs_in_cache_dirs: list[str],
venv_cache: Path,
venv_activate_37: None,
tester.execute() tester.execute()
expected = ( expected = (
"\n".join(venvs_in_cache_dirs).strip().replace("py3.7", "py3.7 (Activate d)") "\n".join(venvs_in_cache_dirs).strip().replace("py3.7", "py3.7 (Activate d)")
) )
assert expected == tester.io.fetch_output().strip() assert tester.io.fetch_output().strip() == expected
def test_in_project_venv(tester, venvs_in_project_dir): def test_in_project_venv(tester: CommandTester, venvs_in_project_dir: list[str]) :
tester.execute() tester.execute()
expected = ".venv (Activated)\n" expected = ".venv (Activated)\n"
assert expected == tester.io.fetch_output() assert tester.io.fetch_output() == expected
 End of changes. 10 change blocks. 
7 lines changed or deleted 30 lines changed or added

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