Skip to content

Commit

Permalink
added testcase
Browse files Browse the repository at this point in the history
Change-Id: Ie793d88098f20dc622f398334a77f63cacfe982d
  • Loading branch information
rmittal87 committed Sep 13, 2023
1 parent a6fbe46 commit 4e2e992
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 16 deletions.
32 changes: 16 additions & 16 deletions libmamba/src/api/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,16 +589,16 @@ namespace mamba
);
}

std::vector<LockFile> locks;
std::vector<LockFile> locks;

for (auto& c : ctx.pkgs_dirs)
{
locks.push_back(LockFile(c));
}
for (auto& c : ctx.pkgs_dirs)
{
locks.push_back(LockFile(c));
}

MTransaction trans(pool, solver, package_caches);
if (ctx.output_params.json)

if (ctx.output_params.json)
{
trans.log_json();
}
Expand Down Expand Up @@ -662,15 +662,15 @@ namespace mamba
// Note that the Transaction will gather the Solvables,
// so they must have been ready in the pool before this line
auto transaction = create_transaction(pool, pkg_caches, others);
std::vector<LockFile> lock_pkgs;
for (auto& c : ctx.pkgs_dirs)
{
lock_pkgs.push_back(LockFile(c));
}
if (ctx.output_params.json)

std::vector<LockFile> lock_pkgs;

for (auto& c : ctx.pkgs_dirs)
{
lock_pkgs.push_back(LockFile(c));
}

if (ctx.output_params.json)
{
transaction.log_json();
}
Expand Down
28 changes: 28 additions & 0 deletions micromamba/tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,34 @@ def test_multiple_spec_files(tmp_home, tmp_root_prefix, tmp_path, type):
assert res["specs"] == [explicit_specs[0]]


def test_multiprocessing():
if platform.system() == "Windows":
return

root_prefix = Path(os.environ["MAMBA_ROOT_PREFIX"])
if os.path.exists(root_prefix / "pkgs"):
shutil.rmtree(root_prefix / "pkgs")

cmd = [helpers.get_umamba()]
cmd += ["create", "-n", "env1", "-y"]
cmd += ["airflow"]
cmd += ["pytorch"]
cmd += ["-c", "conda-forge"]

cmd2 = [helpers.get_umamba(), "create"]
cmd2 += ["-n", "env2", "-y"]
cmd2 += ["airflow"]
cmd2 += ["pytorch"]
cmd2 += ["-c", "conda-forge"]

# must not crash
cmds = [cmd, cmd2]
procs = [subprocess.Popen(p) for p in cmds]
for p in procs:
rc = p.wait()
assert rc == 0


@pytest.mark.skipif(
helpers.dry_run_tests is helpers.DryRun.ULTRA_DRY,
reason="Running only ultra-dry tests",
Expand Down

0 comments on commit 4e2e992

Please sign in to comment.