Commit 2d54ec97 by Martin Miglio Committed by GitHub

poetry check command accepts --directory argument (#7241)

parent 7714eda2
from __future__ import annotations
from pathlib import Path
from poetry.console.commands.command import Command
......@@ -61,7 +59,7 @@ class CheckCommand(Command):
from poetry.factory import Factory
# Load poetry config and display errors, if any
poetry_file = Factory.locate(Path.cwd())
poetry_file = self.poetry.file.path
config = PyProjectTOML(poetry_file).poetry_config
check_result = Factory.validate(config, strict=True)
......
......@@ -29,12 +29,17 @@ All set!
def test_check_invalid(mocker: MockerFixture, tester: CommandTester):
from poetry.core.toml import TOMLFile
mocker.patch(
"poetry.factory.Factory.locate",
return_value=Path(__file__).parent.parent.parent
/ "fixtures"
/ "invalid_pyproject"
/ "pyproject.toml",
"poetry.poetry.Poetry.file",
return_value=TOMLFile(
Path(__file__).parent.parent.parent
/ "fixtures"
/ "invalid_pyproject"
/ "pyproject.toml"
),
new_callable=mocker.PropertyMock,
)
tester.execute()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment