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,