Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Windows test build #2585

Merged
merged 3 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libmamba/src/core/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ namespace mamba
}
else if (m_scheme != "")
{
m_canonical_name = m_scheme + "://" + m_location + '/' + m_name;
m_canonical_name = concat_scheme_url(m_scheme, join_url(m_location, m_name));
}
else
{
Expand Down
6 changes: 4 additions & 2 deletions libmamba/tests/src/core/test_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,23 +433,25 @@ namespace mamba
#ifdef _WIN32
std::string driveletter = fs::absolute(fs::u8path("/")).string().substr(0, 1);
CHECK_EQ(c4.location(), driveletter + ":/home/mamba/test");
CHECK_EQ(c4.canonical_name(), "file:///" + driveletter + ":/home/mamba/test/channel_b");
#else
CHECK_EQ(c4.location(), "/home/mamba/test");
CHECK_EQ(c4.canonical_name(), "file:///home/mamba/test/channel_b");
#endif
CHECK_EQ(c4.name(), "channel_b");
CHECK_EQ(c4.canonical_name(), "file:///home/mamba/test/channel_b");
CHECK_EQ(c4.platforms(), std::vector<std::string>({ platform, "noarch" }));

std::string value5 = "/home/mamba/test/channel_b[" + platform + "]";
const Channel& c5 = channel_context.make_channel(value5);
CHECK_EQ(c5.scheme(), "file");
#ifdef _WIN32
CHECK_EQ(c5.location(), driveletter + ":/home/mamba/test");
CHECK_EQ(c5.canonical_name(), "file:///" + driveletter + ":/home/mamba/test/channel_b");
#else
CHECK_EQ(c5.location(), "/home/mamba/test");
CHECK_EQ(c5.canonical_name(), "file:///home/mamba/test/channel_b");
#endif
CHECK_EQ(c5.name(), "channel_b");
CHECK_EQ(c5.canonical_name(), "file:///home/mamba/test/channel_b");
CHECK_EQ(c5.platforms(), std::vector<std::string>({ platform }));

std::string value6a = "http://localhost:8000/conda-forge[noarch]";
Expand Down
17 changes: 17 additions & 0 deletions libmamba/tests/src/core/test_virtual_packages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ namespace mamba
{
namespace testing
{

template <typename Callback>
struct Finally
{
Callback callback;

~Finally()
{
callback();
}
};

TEST_SUITE("virtual_packages")
{
TEST_CASE("make_virtual_package")
Expand Down Expand Up @@ -61,6 +73,11 @@ namespace mamba
CHECK_EQ(pkgs.back().build_string, "x86_64");
#endif

// This is bad design, tests should not interfer
// Will get rid of that when implementing context as not a singleton
auto restore_ctx = [&ctx, old_plat = ctx.platform]() { ctx.platform = old_plat; };
auto finally = Finally<decltype(restore_ctx)>{ restore_ctx };

ctx.platform = "osx-arm";
env::set("CONDA_OVERRIDE_OSX", "12.1");
pkgs = detail::dist_packages();
Expand Down
3 changes: 2 additions & 1 deletion libmamba/tests/src/solv-cpp/pool_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef TEST_MAMBA_SOLV_POOL_DATA_HPP
#define TEST_MAMBA_SOLV_POOL_DATA_HPP

#include <array>
#include <map>
#include <string>
#include <vector>
Expand All @@ -32,7 +33,7 @@ namespace mamba::test

inline auto make_packages()
{
return std::array{
return std::array<SimplePkg, 16>{
SimplePkg{ "menu", "1.5.0", { "dropdown=2.*" } },
SimplePkg{ "menu", "1.4.0", { "dropdown=2.*" } },
SimplePkg{ "menu", "1.3.0", { "dropdown=2.*" } },
Expand Down