From b2efa8bfa47b34f0d09a268315c66bf46b8f3315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:00:24 +0100 Subject: [PATCH] fix some tests (#8654) --- tests/console/commands/test_check.py | 10 ++++------ tests/console/commands/test_install.py | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/console/commands/test_check.py b/tests/console/commands/test_check.py index d5e8a44cea8..421c50dcb54 100644 --- a/tests/console/commands/test_check.py +++ b/tests/console/commands/test_check.py @@ -5,6 +5,7 @@ import pytest from poetry.packages import Locker +from poetry.toml import TOMLFile if TYPE_CHECKING: @@ -67,8 +68,6 @@ def test_check_valid(tester: CommandTester) -> None: def test_check_invalid( mocker: MockerFixture, tester: CommandTester, fixture_dir: FixtureDirGetter ) -> None: - from poetry.toml import TOMLFile - mocker.patch( "poetry.poetry.Poetry.file", return_value=TOMLFile(fixture_dir("invalid_pyproject") / "pyproject.toml"), @@ -107,8 +106,9 @@ def test_check_private( mocker: MockerFixture, tester: CommandTester, fixture_dir: FixtureDirGetter ) -> None: mocker.patch( - "poetry.factory.Factory.locate", - return_value=fixture_dir("private_pyproject") / "pyproject.toml", + "poetry.poetry.Poetry.file", + return_value=TOMLFile(fixture_dir("private_pyproject") / "pyproject.toml"), + new_callable=mocker.PropertyMock, ) tester.execute() @@ -135,8 +135,6 @@ def test_check_lock_missing( expected: str, expected_status: int, ) -> None: - from poetry.toml import TOMLFile - mocker.patch( "poetry.poetry.Poetry.file", return_value=TOMLFile(fixture_dir("private_pyproject") / "pyproject.toml"), diff --git a/tests/console/commands/test_install.py b/tests/console/commands/test_install.py index bf0789c8616..a62ac6cd276 100644 --- a/tests/console/commands/test_install.py +++ b/tests/console/commands/test_install.py @@ -416,7 +416,7 @@ def test_install_logs_output_decorated( assert tester.io.fetch_output() == expected -@pytest.mark.parametrize("with_root", [True]) +@pytest.mark.parametrize("with_root", [True, False]) @pytest.mark.parametrize("error", ["module", "readme", ""]) def test_install_warning_corrupt_root( command_tester_factory: CommandTesterFactory,