micromamba tests: added lockfile test

This commit is contained in:
Joël Lamotte (Klaim) 2022-04-07 11:50:19 +02:00
parent 3674c213de
commit 22d91d3f60
2 changed files with 215 additions and 1 deletions

View File

@ -11,6 +11,8 @@ import pytest
from .helpers import *
source_dir_path = os.path.dirname(os.path.realpath(__file__))
class TestCreate:
@ -26,8 +28,13 @@ class TestCreate:
os.path.join("~", "mamba_spec_files_test_" + random_string())
)
test_lockfile_path = os.path.realpath(
os.path.join(source_dir_path, "test_env-lock.yaml")
)
@classmethod
def setup_class(cls):
assert os.path.exists(TestCreate.test_lockfile_path)
os.environ["MAMBA_ROOT_PREFIX"] = TestCreate.root_prefix
os.makedirs(TestCreate.spec_files_location, exist_ok=True)
@ -100,10 +107,12 @@ class TestCreate:
]
file_content = ["@EXPLICIT"] + explicit_specs
specs = explicit_specs
else: # yaml
elif file_type == "yaml":
spec_file += ".yaml"
file_content = ["dependencies:", " - xtensor >0.20", " - xsimd"]
specs += ["xtensor >0.20", "xsimd"]
else:
raise RuntimeError("unhandled file type : ", file_type)
os.makedirs(TestCreate.root_prefix, exist_ok=True)
with open(spec_file, "w") as f:
@ -120,6 +129,22 @@ class TestCreate:
json_res = create(*cmd, "--json")
assert json_res["success"] == True
def test_lockfile(self):
cmd_prefix = ["-p", TestCreate.prefix]
f_name = random_string()
spec_file = os.path.join(TestCreate.spec_files_location, f_name) + "-lock.yaml"
shutil.copyfile(TestCreate.test_lockfile_path, spec_file)
assert os.path.exists(spec_file)
res = create(*cmd_prefix, "-f", spec_file, "--json")
assert res["success"] == True
packages = umamba_list(*cmd_prefix, "--json")
assert any(
package["name"] == "zlib" and package["version"] == "1.2.11"
for package in packages
)
@pytest.mark.parametrize("root_prefix", (None, "env_var", "cli"))
@pytest.mark.parametrize("target_is_root", (False, True))
@pytest.mark.parametrize("cli_prefix", (False, True))

View File

@ -0,0 +1,189 @@
# This lock file was generated by conda-lock (https://github.com/conda-incubator/conda-lock). DO NOT EDIT!
#
# A "lock file" contains a concrete list of package versions (with checksums) to be installed. Unlike
# e.g. `conda env create`, the resulting environment will not change as new package versions become
# available, unless you explicitly update the lock file.
#
# Install this environment as "YOURENV" with:
# conda-lock install -n YOURENV --file conda-lock.yml
# To update a single package to the latest version compatible with the version constraints in the source:
# conda-lock lock --lockfile conda-lock.yml --update PACKAGE
# To re-solve the entire environment, e.g. after changing a version constraint in the source file:
# conda-lock -f environment.yml --lockfile conda-lock.yml
metadata:
channels:
- url: conda-forge
used_env_vars: []
- url: defaults
used_env_vars: []
content_hash:
linux-64: 1173e3c96ce20d063a5701b325b76deb97394f891af270af4ee0cb7cc1f6e838
osx-64: d01c1f5433f30bdbcd3bdad8d9b096774ab55f1210c094acdc61a35b32b28d67
win-64: 310b23581083bfb983927c40d3bdc86162192d7b26ffd7bffc385f627c155697
platforms:
- linux-64
- osx-64
- win-64
sources:
- environment.yml
package:
- category: main
dependencies: {}
hash:
md5: d7c89558ba9fa0495403155b64376d81
sha256: fe51de6107f9edc7aa4f786a70f4a883943bc9d39b3bb7307c04c41410990726
manager: conda
name: _libgcc_mutex
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2
version: '0.1'
- category: main
dependencies:
_libgcc_mutex: 0.1 conda_forge
hash:
md5: 8e91f1f21417c9ab1265240ee4f9db1e
sha256: 4d705a82c554d1abb80aedd0593e0abde54f71b7a5c87492c750c9759b7706fd
manager: conda
name: libgomp
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/libgomp-11.2.0-h1d223b6_13.tar.bz2
version: 11.2.0
- category: main
dependencies:
_libgcc_mutex: 0.1 conda_forge
libgomp: '>=7.5.0'
hash:
md5: 561e277319a41d4f24f5c05a9ef63c04
sha256: 81c74d38c80345e195106dc3a5b4063b61f2209402bf9f6c7e2abadef4f544a3
manager: conda
name: _openmp_mutex
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/_openmp_mutex-4.5-1_gnu.tar.bz2
version: '4.5'
- category: main
dependencies:
_libgcc_mutex: 0.1 conda_forge
_openmp_mutex: '>=4.5'
hash:
md5: 63eaf0f146cc80abd84743d48d667da4
sha256: 5c9c8a23e45215e0c218a477c69054ed2ac577c4499795649dd3343687d380ff
manager: conda
name: libgcc-ng
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/libgcc-ng-11.2.0-h1d223b6_13.tar.bz2
version: 11.2.0
- category: main
dependencies:
libgcc-ng: '>=7.5.0'
hash:
md5: dcddf696ff5dfcab567100d691678e18
sha256: 8292882ea5cfbe2e6b708432dfab0668f2acddb96ab7618163001acbd13678e4
manager: conda
name: libzlib
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/libzlib-1.2.11-h36c2ea0_1013.tar.bz2
version: 1.2.11
- category: main
dependencies:
libgcc-ng: '>=7.5.0'
libzlib: 1.2.11 h36c2ea0_1013
hash:
md5: cf7190238072a41e9579e4476a6a60b8
sha256: cec48db35a7def0011bfdaa2b91e5e05d2a0ad788b8871a213eb8cacfeb7418a
manager: conda
name: zlib
optional: false
platform: linux-64
url: https://conda.anaconda.org/conda-forge/linux-64/zlib-1.2.11-h36c2ea0_1013.tar.bz2
version: 1.2.11
- category: main
dependencies: {}
hash:
md5: a3a6a53beaa92c5cfe52ee3a198e78cc
sha256: 2421046db13b5f161a4330ff4f0e536999bce1ea3b8db5eb0d78e045146707ca
manager: conda
name: libzlib
optional: false
platform: osx-64
url: https://conda.anaconda.org/conda-forge/osx-64/libzlib-1.2.11-h9173be1_1013.tar.bz2
version: 1.2.11
- category: main
dependencies:
libzlib: 1.2.11 h9173be1_1013
hash:
md5: cf985617d679990418c380099620b01a
sha256: 9102c5f89c78c56b0bb0766a074f509d67362cf97aa66d706d4e95e9061bb03c
manager: conda
name: zlib
optional: false
platform: osx-64
url: https://conda.anaconda.org/conda-forge/osx-64/zlib-1.2.11-h9173be1_1013.tar.bz2
version: 1.2.11
- category: main
dependencies: {}
hash:
md5: 6d666b6ea8251231ff508062d1e41f9c
sha256: e5a8634df6ee84745dfe27f40ace7b6e45646a4b7bc7dbeb1efe1bb6128e44b9
manager: conda
name: ucrt
optional: false
platform: win-64
url: https://conda.anaconda.org/conda-forge/win-64/ucrt-10.0.20348.0-h57928b3_0.tar.bz2
version: 10.0.20348.0
- category: main
dependencies:
ucrt: '>=10.0.20348.0'
hash:
md5: 33d07ebe91062743eabc9e53a60d18e1
sha256: f2efbbe3465a34b195edd218d5572c998d94c5964d4e495c3d7f95c8bb5fcaac
manager: conda
name: vs2015_runtime
optional: false
platform: win-64
url: https://conda.anaconda.org/conda-forge/win-64/vs2015_runtime-14.29.30037-h902a5da_6.tar.bz2
version: 14.29.30037
- category: main
dependencies:
vs2015_runtime: '>=14.28.29325'
hash:
md5: c2aecbc9b00ba6f352e27d3d61fd31fb
sha256: c6e7d2b9ceafe2cc302fb8fce1dfcc46b49c5333757424a34294bffdfb5569be
manager: conda
name: vc
optional: false
platform: win-64
url: https://conda.anaconda.org/conda-forge/win-64/vc-14.2-hb210afc_6.tar.bz2
version: '14.2'
- category: main
dependencies:
vc: '>=14.1,<15.0a0'
vs2015_runtime: '>=14.16.27012'
hash:
md5: b28dd2488b4e5f892c67071acc1d0a8c
sha256: 5b7e002932c0138d78d251caae0c571d13f857ff90e7ce21d58d67073381250e
manager: conda
name: libzlib
optional: false
platform: win-64
url: https://conda.anaconda.org/conda-forge/win-64/libzlib-1.2.11-h8ffe710_1013.tar.bz2
version: 1.2.11
- category: main
dependencies:
libzlib: 1.2.11 h8ffe710_1013
vc: '>=14.1,<15.0a0'
vs2015_runtime: '>=14.16.27012'
hash:
md5: 866517df4fd8bb813bc20c24cf7b8f05
sha256: 5b5db5ec4c2eb51a2bb8c5e22df9938703fd292da8a41c1e8355d5972f9fe12c
manager: conda
name: zlib
optional: false
platform: win-64
url: https://conda.anaconda.org/conda-forge/win-64/zlib-1.2.11-h8ffe710_1013.tar.bz2
version: 1.2.11
version: 1