mirror of https://github.com/mamba-org/mamba.git
fix: Explain unsolvable updates (#3829)
This commit is contained in:
parent
80019ba423
commit
746360cb15
|
@ -200,6 +200,14 @@ namespace mamba
|
|||
auto outcome = solver::libsolv::Solver().solve(db, request).value();
|
||||
if (auto* unsolvable = std::get_if<solver::libsolv::UnSolvable>(&outcome))
|
||||
{
|
||||
unsolvable->explain_problems_to(
|
||||
db,
|
||||
LOG_ERROR,
|
||||
{
|
||||
/* .unavailable= */ ctx.graphics_params.palette.failure,
|
||||
/* .available= */ ctx.graphics_params.palette.success,
|
||||
}
|
||||
);
|
||||
if (ctx.output_params.json)
|
||||
{
|
||||
Console::instance().json_write({ { "success", false },
|
||||
|
|
|
@ -216,6 +216,19 @@ class TestUpdate:
|
|||
else:
|
||||
assert "To activate this environment, use:" not in res
|
||||
|
||||
def test_update_explains_problems(self, env_created):
|
||||
# Non-regression test for: https://github.com/mamba-org/mamba/issues/3828
|
||||
with pytest.raises(helpers.subprocess.CalledProcessError) as e:
|
||||
helpers.update("-n", TestUpdate.env_name, "xtensor=0.24.5", "xtensor=0.25.0")
|
||||
err_string = str(e.value.stderr.decode("utf-8"))
|
||||
assert "The following packages are incompatible" in err_string
|
||||
|
||||
def test_update_explains_problems_json(self, env_created):
|
||||
with pytest.raises(helpers.subprocess.CalledProcessError) as e:
|
||||
helpers.update("-n", TestUpdate.env_name, "xtensor=0.24.5", "xtensor=0.25.0", "--json")
|
||||
out_string = str(e.value.stdout.decode("utf-8"))
|
||||
assert "cannot install both" in out_string
|
||||
|
||||
|
||||
class TestUpdateConfig:
|
||||
current_root_prefix = os.environ["MAMBA_ROOT_PREFIX"]
|
||||
|
|
Loading…
Reference in New Issue