Commit bbff6e8e by Sébastien Eustace

Bring back error solutions

parent 3a1b45fc
......@@ -95,7 +95,7 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[[package]]
name = "cleo"
version = "1.0.0a3"
version = "1.0.0a4"
description = "Cleo allows you to create beautiful and testable command-line interfaces."
category = "main"
optional = false
......@@ -708,7 +708,7 @@ testing = ["pytest (>=4.6)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pyt
[metadata]
lock-version = "1.1"
python-versions = "^3.6"
content-hash = "e38d34da68dcd63ef9f9d999f60b8e19d8da7f988031c3a6e6865d51c1fadeda"
content-hash = "b7c8e4bf22ded396181d2c02894fcd80e1b50a3c4762250afdd2a681eb65d991"
[metadata.files]
appdirs = [
......@@ -783,8 +783,8 @@ chardet = [
{file = "chardet-4.0.0.tar.gz", hash = "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa"},
]
cleo = [
{file = "cleo-1.0.0a3-py3-none-any.whl", hash = "sha256:46b2f970d06caa311d1e12a1013b0ce2a8149502669ac82cbedafb9e0bfdbccd"},
{file = "cleo-1.0.0a3.tar.gz", hash = "sha256:9c1c8dd06635c936f45e4649aa2f7581517b4d52c7a9414d1b42586e63c2fe5d"},
{file = "cleo-1.0.0a4-py3-none-any.whl", hash = "sha256:cdd0c3458c15ced3a9f0204b1e53a1b4bee3c56ebcb3ac54c872a56acc657a09"},
{file = "cleo-1.0.0a4.tar.gz", hash = "sha256:a103a065d031b7d936ee88a6b93086a69bd9c1b40fa2ebfe8c056285a66b481d"},
]
colorama = [
{file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"},
......
......@@ -26,6 +26,12 @@ from .command_loader import CommandLoader
from .commands.command import Command
if TYPE_CHECKING:
from crashtest.solution_providers.solution_provider_repository import (
SolutionProviderRepository,
)
def load_command(name: str) -> Callable:
def _load() -> Type[Command]:
module = import_module(
......@@ -159,6 +165,13 @@ class Application(BaseApplication):
return io
def render_error(self, error: Exception, io: IO) -> None:
# We set the solution provider repository here to load providers
# only when an error occurs
self.set_solution_provider_repository(self._get_solution_provider_repository())
super().render_error(error, io)
def _run(self, io: IO) -> int:
self._disable_plugins = io.input.parameter_option("--no-plugins")
......@@ -330,6 +343,20 @@ class Application(BaseApplication):
return definition
def _get_solution_provider_repository(self) -> "SolutionProviderRepository":
from crashtest.solution_providers.solution_provider_repository import (
SolutionProviderRepository,
)
from poetry.mixology.solutions.providers.python_requirement_solution_provider import (
PythonRequirementSolutionProvider,
)
repository = SolutionProviderRepository()
repository.register_solution_providers([PythonRequirementSolutionProvider])
return repository
def main() -> int:
return Application().run()
......
......@@ -32,7 +32,7 @@ generate-setup-file = false
python = "^3.6"
poetry-core = { git = "https://github.com/python-poetry/poetry-core.git", branch = "master" }
cleo = "^1.0.0a1"
cleo = "^1.0.0a4"
crashtest = "^0.3.0"
requests = "^2.18"
cachy = "^0.3.0"
......
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