mirror of https://github.com/mamba-org/mamba.git
fix: Activated environment name (#3670)
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
This commit is contained in:
parent
4c5c1d7430
commit
53ba5c0326
|
@ -56,10 +56,10 @@ namespace mamba
|
|||
{
|
||||
return "base";
|
||||
}
|
||||
// if ../miniconda3/envs/my_super_env, return `my_super_env`, else path
|
||||
if (prefix.parent_path().stem() == "envs")
|
||||
// if ../miniconda3/envs/my_super.env, return `my_super.env`, else path
|
||||
if (prefix.parent_path().filename() == "envs")
|
||||
{
|
||||
return prefix.stem().string();
|
||||
return prefix.filename().string();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -16,5 +16,23 @@ namespace mamba
|
|||
// std::endl; std::cout << a.activate("/home/wolfv/miniconda3/", false) <<
|
||||
// std::endl;
|
||||
}
|
||||
|
||||
TEST_CASE("Activator::get_default_env")
|
||||
{
|
||||
Context ctx;
|
||||
ctx.prefix_params.root_prefix = "/home/user/miniforge";
|
||||
PosixActivator a(ctx);
|
||||
REQUIRE(a.get_default_env("/home/user/miniforge") == "base");
|
||||
REQUIRE(a.get_default_env("/home/user/miniforge/envs/env") == "env");
|
||||
REQUIRE(a.get_default_env("/home/user/miniforge/envs/an.env") == "an.env");
|
||||
REQUIRE(a.get_default_env("/home/user/miniforge/envs/an-oth.er") == "an-oth.er");
|
||||
REQUIRE(a.get_default_env("/opt/envs/yet.an-oth.er") == "yet.an-oth.er");
|
||||
|
||||
const fs::u8path& alternative_folder = "/opt/envs.d/env";
|
||||
REQUIRE(a.get_default_env(alternative_folder) == alternative_folder);
|
||||
|
||||
const fs::u8path& alt_folder = "/home/user/some/env";
|
||||
REQUIRE(a.get_default_env(alt_folder) == alt_folder);
|
||||
}
|
||||
}
|
||||
} // namespace mamba
|
||||
|
|
Loading…
Reference in New Issue