"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/console/commands/env/test_info.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_info.py  (poetry-1.1.15):test_info.py  (poetry-1.2.0)
from __future__ import annotations
import sys
from pathlib import Path
from typing import TYPE_CHECKING
import pytest import pytest
from poetry.utils._compat import Path
from poetry.utils.env import MockEnv from poetry.utils.env import MockEnv
if TYPE_CHECKING:
from cleo.testers.command_tester import CommandTester
from pytest_mock import MockerFixture
from tests.types import CommandTesterFactory
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def setup(mocker): def setup(mocker: MockerFixture) -> None:
mocker.patch( mocker.patch(
"poetry.utils.env.EnvManager.get", "poetry.utils.env.EnvManager.get",
return_value=MockEnv( return_value=MockEnv(
path=Path("/prefix"), base=Path("/base/prefix"), is_venv=True path=Path("/prefix"), base=Path("/base/prefix"), is_venv=True
), ),
) )
@pytest.fixture @pytest.fixture
def tester(command_tester_factory): def tester(command_tester_factory: CommandTesterFactory) -> CommandTester:
return command_tester_factory("env info") return command_tester_factory("env info")
def test_env_info_displays_complete_info(tester): def test_env_info_displays_complete_info(tester: CommandTester):
tester.execute() tester.execute()
expected = """ expected = f"""
Virtualenv Virtualenv
Python: 3.7.0 Python: 3.7.0
Implementation: CPython Implementation: CPython
Path: {prefix} Path: {Path('/prefix')}
Executable: {sys.executable}
Valid: True Valid: True
System System
Platform: darwin Platform: darwin
OS: posix OS: posix
Python: {base_prefix} Python: {'.'.join(str(v) for v in sys.version_info[:3])}
""".format( Path: {Path('/base/prefix')}
prefix=str(Path("/prefix")), base_prefix=str(Path("/base/prefix")) Executable: python
) """
assert expected == tester.io.fetch_output() assert tester.io.fetch_output() == expected
def test_env_info_displays_path_only(tester): def test_env_info_displays_path_only(tester: CommandTester):
tester.execute("--path") tester.execute("--path")
expected = str(Path("/prefix")) expected = str(Path("/prefix")) + "\n"
assert expected + "\n" == tester.io.fetch_output() assert tester.io.fetch_output() == expected
 End of changes. 12 change blocks. 
14 lines changed or deleted 27 lines changed or added

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