Skip to content

Commit 9d15db7

Browse files
committed
Code review: add comment and use vars in tests
1 parent 09c8f32 commit 9d15db7

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

libmamba/tests/src/core/test_package_fetcher.cpp

+11-16
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ namespace
2424
auto pkg_info = specs::PackageInfo::from_url(url).value();
2525

2626
PackageFetcher pkg_fetcher{ pkg_info, package_caches };
27-
REQUIRE(pkg_fetcher.name() == "pkg");
27+
REQUIRE(pkg_fetcher.name() == pkg_info.name);
2828

2929
auto req = pkg_fetcher.build_download_request();
3030
// Should correspond to package name
31-
REQUIRE(req.name == "pkg");
31+
REQUIRE(req.name == pkg_info.name);
3232
// Should correspond to PackageFetcher::channel()
3333
REQUIRE(req.mirror_name == "");
3434
// Should correspond to PackageFetcher::url_path()
35-
REQUIRE(
36-
req.url_path == "https://conda.anaconda.org/conda-forge/linux-64/pkg-6.4-bld.conda"
37-
);
35+
REQUIRE(req.url_path == url);
3836
}
3937

4038
SECTION("From some mirror")
@@ -43,18 +41,15 @@ namespace
4341
auto pkg_info = specs::PackageInfo::from_url(url).value();
4442

4543
PackageFetcher pkg_fetcher{ pkg_info, package_caches };
46-
REQUIRE(pkg_fetcher.name() == "cpp-tabulate");
44+
REQUIRE(pkg_fetcher.name() == pkg_info.name);
4745

4846
auto req = pkg_fetcher.build_download_request();
4947
// Should correspond to package name
50-
REQUIRE(req.name == "cpp-tabulate");
48+
REQUIRE(req.name == pkg_info.name);
5149
// Should correspond to PackageFetcher::channel()
5250
REQUIRE(req.mirror_name == "");
5351
// Should correspond to PackageFetcher::url_path()
54-
REQUIRE(
55-
req.url_path
56-
== "https://repo.prefix.dev/emscripten-forge-dev/emscripten-wasm32/cpp-tabulate-1.5.0-h7223423_2.tar.bz2"
57-
);
52+
REQUIRE(req.url_path == url);
5853
}
5954

6055
SECTION("From local file")
@@ -63,15 +58,15 @@ namespace
6358
auto pkg_info = specs::PackageInfo::from_url(url).value();
6459

6560
PackageFetcher pkg_fetcher{ pkg_info, package_caches };
66-
REQUIRE(pkg_fetcher.name() == "xtensor");
61+
REQUIRE(pkg_fetcher.name() == pkg_info.name);
6762

6863
auto req = pkg_fetcher.build_download_request();
6964
// Should correspond to package name
70-
REQUIRE(req.name == "xtensor");
65+
REQUIRE(req.name == pkg_info.name);
7166
// Should correspond to PackageFetcher::channel()
7267
REQUIRE(req.mirror_name == "");
7368
// Should correspond to PackageFetcher::url_path()
74-
REQUIRE(req.url_path == "file:///home/wolfv/Downloads/xtensor-0.21.4-hc9558a2_0.tar.bz2");
69+
REQUIRE(req.url_path == url);
7570
}
7671

7772
SECTION("From oci")
@@ -80,11 +75,11 @@ namespace
8075
auto pkg_info = specs::PackageInfo::from_url(url).value();
8176

8277
PackageFetcher pkg_fetcher{ pkg_info, package_caches };
83-
REQUIRE(pkg_fetcher.name() == "xtensor");
78+
REQUIRE(pkg_fetcher.name() == pkg_info.name);
8479

8580
auto req = pkg_fetcher.build_download_request();
8681
// Should correspond to package name
87-
REQUIRE(req.name == "xtensor");
82+
REQUIRE(req.name == pkg_info.name);
8883
// Should correspond to PackageFetcher::channel()
8984
REQUIRE(req.mirror_name == "oci://ghcr.io/channel-mirrors/conda-forge");
9085
// Should correspond to PackageFetcher::url_path()

micromamba/tests/test_create.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,10 @@ def test_create_with_explicit_url(tmp_home, tmp_root_prefix, spec):
13351335

13361336

13371337
def test_create_from_mirror(tmp_home, tmp_root_prefix):
1338-
"""Attempts to install a package using an explicit channel/mirror."""
1338+
"""
1339+
Attempts to install a package using an explicit channel/mirror.
1340+
Non-regression test for https://github.com/mamba-org/mamba/issues/3804
1341+
"""
13391342
env_name = "env-create-from-mirror"
13401343

13411344
res = helpers.create(

0 commit comments

Comments
 (0)