Refactor CI and libamambapy tests (on Unix) (#2952)

* Add simple libmambapy test

* Use CMakePresets in CI

* Share workspace between jobs

* Add Conda dependency

* Remove CMake STRIP

* Fix menuinst skipping

* Refactor CMakePresets

* Change ccache key

* Add pkg-config
This commit is contained in:
Antoine Prouvost 2023-11-02 13:55:39 +01:00 committed by GitHub
parent 5564887b97
commit fdf2b65a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 404 additions and 242 deletions

48
.github/actions/workspace/action.yml vendored Normal file
View File

@ -0,0 +1,48 @@
name: workspace
description: 'A action to persist your workspace across different jobs'
branding:
icon: 'box'
color: 'green'
inputs:
action:
required: true
options:
- save
- restore
- delete
path:
required: true
key_prefix:
default: workspace
key_base:
required: true
default: ${{ github.workflow }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}-${{ github.sha }}
key_suffix:
default: ''
token:
required: false
default: ${{ github.token }}
runs:
using: "composite"
steps:
- name: Create workspace
if: ${{ inputs.action == 'save' }}
uses: actions/cache/save@v3
with:
path: ${{ inputs.path }}
key: ${{ inputs.key_prefix }}-${{ inputs.key_base }}-${{ inputs.key_suffix }}
- name: Restore workspace
if: ${{ inputs.action == 'restore' }}
uses: actions/cache/restore@v3
with:
path: ${{ inputs.path }}
key: ${{ inputs.key_prefix }}-${{ inputs.key_base }}-${{ inputs.key_suffix }}
fail-on-cache-miss: true
- name: Delete workspace
if: ${{ inputs.action == 'delete' }}
shell: bash
env:
GH_TOKEN: ${{ inputs.token }}
run: |
gh cache delete '${{ inputs.key_prefix }}-${{ inputs.key_base }}-${{ inputs.key_suffix }}'

View File

@ -16,120 +16,14 @@ concurrency:
cancel-in-progress: true
jobs:
libmamba_tests_unix:
name: libmamba tests
runs-on: ${{ matrix.os }}
unix_tests:
name: Unix tests
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v3
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
restore-keys: |
libmamba-${{ matrix.os }}
- name: Build libmamba
shell: bash -l {0}
run: |
cmake -B build/ \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D BUILD_LIBMAMBA=ON \
-D BUILD_LIBMAMBAPY=ON \
-D BUILD_SHARED=ON \
-D BUILD_LIBMAMBA_TESTS=ON \
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
-G Ninja
cmake --build build/ --parallel --target test_libmamba testing_libmamba_lock
- name: Run libmamba tests
shell: bash -l {0}
run: |
unset CONDARC # Interferes with tests
cd build && ninja test
- name: Show build cache statistics
run: sccache --show-stats
umamba_integration_tests_unix:
name: Micromamba integration tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
steps:
- uses: actions/checkout@v3
- name: create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
create-args: >-
conda-build
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ matrix.os }}
restore-keys: |
libmamba-${{ matrix.os }}
- name: build micromamba
shell: bash -l {0}
run: |
cmake -B build/ \
-D CMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-D BUILD_MICROMAMBA=ON \
-D BUILD_MICROMAMBA_SERVER=ON \
-D BUILD_LIBMAMBA=ON \
-D BUILD_SHARED=ON \
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-D CMAKE_C_COMPILER_LAUNCHER=sccache \
-G Ninja
cmake --build build/ --parallel
- name: build cache statistics
run: sccache --show-stats
- name: install zsh, xonsh, fish and tcsh in linux
if: matrix.os == 'ubuntu-latest'
shell: bash -l -eo pipefail {0}
run: |
sudo apt-get install zsh xonsh fish tcsh -y
- name: install xonsh and fish in mac
if: matrix.os == 'macos-latest'
shell: bash -l -eo pipefail {0}
run: |
brew install fish xonsh
- name: micromamba python based tests
shell: bash -l -eo pipefail {0}
run: |
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/micromamba
unset CONDARC # Interferes with tests
pytest -v --capture=tee-sys micromamba/tests/
- name: micromamba local channel test
shell: bash -l -eo pipefail {0}
run: |
unset CONDARC # Interferes with tests
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir -p $MAMBA_ROOT_PREFIX/conda-bld/linux-64
wget -P $MAMBA_ROOT_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/linux-64/xtensor-0.21.8-hc9558a2_0.tar.bz2
wget -P $MAMBA_ROOT_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/linux-64/xtl-0.6.21-h0efe328_0.tar.bz2
else
mkdir -p $MAMBA_ROOT_PREFIX/conda-bld/osx-64
wget -P $MAMBA_ROOT_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/osx-64/xtensor-0.21.8-h879752b_0.tar.bz2
wget -P $MAMBA_ROOT_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/osx-64/xtl-0.6.21-h6516342_0.tar.bz2
fi
conda index $MAMBA_ROOT_PREFIX/conda-bld
micromamba create -n l_o_cal_test xtensor -c local -c conda-forge -y
micromamba list -n l_o_cal_test
micromamba list -n l_o_cal_test | tail -n +3 > list.txt
if [ "$(grep -c "conda-bld" list.txt)" -ne 2 ]; then
exit 1
fi
build_type: [release, debug]
fail-fast: false
uses: ./.github/workflows/unix_impl.yml
with:
os: ${{ matrix.os }}
build_type: ${{ matrix.build_type }}

158
.github/workflows/unix_impl.yml vendored Normal file
View File

@ -0,0 +1,158 @@
name: Unix tests impl
on:
workflow_call:
inputs:
os:
required: true
type: string
build_type:
required: true
type: string
defaults:
run:
# micromamba activation
shell: bash -l -eo pipefail {0}
jobs:
build_shared_unix:
name: Build binaries
runs-on: ${{ inputs.os }}
steps:
- name: Checkout mamba repository
uses: actions/checkout@v4
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./dev/environment-dev.yml
environment-name: build_env
cache-environment: true
- uses: hendrikmuhs/ccache-action@main
with:
variant: sccache
key: ${{ github.job }}-${{ inputs.os }}
restore-keys: |
ccache-libmamba-${{ inputs.os }}
- name: Build mamba
run: |
cmake -B build/ -G Ninja \
--preset mamba-unix-shared-${{ inputs.build_type }} \
-D CMAKE_CXX_COMPILER_LAUNCHER=sccache \
-D CMAKE_C_COMPILER_LAUNCHER=sccache
cmake --build build/ --parallel
- name: Show build cache statistics
run: sccache --show-stats
- name: Lock environment
run: micromamba env export --explicit > build/environment.lock
- name: Remove extra files before saving workspace
run: find build/ -type f -name '*.o' -exec rm {} +
- name: Save workspace
uses: ./.github/actions/workspace
with:
action: save
path: build/
key_suffix: ${{ inputs.os }}-${{ inputs.build_type }}
libmamba_tests_unix:
name: Test libmamba
needs: ["build_shared_unix"]
runs-on: ${{ inputs.os }}
steps:
- name: Checkout mamba repository
uses: actions/checkout@v4
- name: Restore workspace
uses: ./.github/actions/workspace
with:
action: restore
path: build/
key_suffix: ${{ inputs.os }}-${{ inputs.build_type }}
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./build/environment.lock
environment-name: build_env
- name: Run libmamba tests
run: |
unset CONDARC # Interferes with tests
cd build/libmamba/tests/ && ./test_libmamba
libmambay_tests_unix:
name: Test libmamba Python bindings
needs: ["build_shared_unix"]
runs-on: ${{ inputs.os }}
steps:
- name: Checkout mamba repository
uses: actions/checkout@v4
- name: Restore workspace
uses: ./.github/actions/workspace
with:
action: restore
path: build/
key_suffix: ${{ inputs.os }}-${{ inputs.build_type }}
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./build/environment.lock
environment-name: build_env
- name: Install libmambapy
run: |
ln build/libmambapy/bindings* libmambapy/libmambapy/
cmake --install build/ --prefix "${CONDA_PREFIX}"
python -m pip install ./libmambapy/
- name: Run libmamba Python bindings tests
run: |
python -m pytest libmambapy/tests/
umamba_integration_tests_unix:
name: Test integration micromamba
needs: ["build_shared_unix"]
runs-on: ${{ inputs.os }}
steps:
- name: Checkout mamba repository
uses: actions/checkout@v4
- name: Restore workspace
uses: ./.github/actions/workspace
with:
action: restore
path: build/
key_suffix: ${{ inputs.os }}-${{ inputs.build_type }}
- name: Create build environment
uses: mamba-org/setup-micromamba@v1
with:
environment-file: ./build/environment.lock
environment-name: build_env
- name: install zsh, xonsh, fish and tcsh in linux
if: startsWith(inputs.os, 'ubuntu')
run: |
sudo apt-get install zsh xonsh fish tcsh -y
- name: install xonsh and fish in mac
if: startsWith(inputs.os, 'macos')
run: |
brew install fish xonsh
- name: micromamba python based tests
run: |
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/micromamba
unset CONDARC # Interferes with tests
pytest -v --capture=tee-sys micromamba/tests/
- name: micromamba local channel test
run: |
unset CONDARC # Interferes with tests
export TEST_MAMBA_EXE=$(pwd)/build/micromamba/micromamba
if [ "$RUNNER_OS" == "Linux" ]; then
mkdir -p $MAMBA_ROOT_PREFIX/conda-bld/linux-64
wget -P $MAMBA_ROOT_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/linux-64/xtensor-0.21.8-hc9558a2_0.tar.bz2
wget -P $MAMBA_ROOT_PREFIX/conda-bld/linux-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/linux-64/xtl-0.6.21-h0efe328_0.tar.bz2
else
mkdir -p $MAMBA_ROOT_PREFIX/conda-bld/osx-64
wget -P $MAMBA_ROOT_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtensor/0.21.8/download/osx-64/xtensor-0.21.8-h879752b_0.tar.bz2
wget -P $MAMBA_ROOT_PREFIX/conda-bld/osx-64 https://anaconda.org/conda-forge/xtl/0.6.21/download/osx-64/xtl-0.6.21-h6516342_0.tar.bz2
fi
conda index $MAMBA_ROOT_PREFIX/conda-bld
"${TEST_MAMBA_EXE}" create -n l_o_cal_test xtensor -c local -c conda-forge -y
"${TEST_MAMBA_EXE}" list -n l_o_cal_test
"${TEST_MAMBA_EXE}" list -n l_o_cal_test | tail -n +3 > list.txt
if [ "$(grep -c "conda-bld" list.txt)" -ne 2 ]; then
exit 1
fi

View File

@ -1,129 +1,46 @@
{
"configurePresets": [
{
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_AR": "$env{AR}",
"CMAKE_CXX_COMPILER": "$env{CXX}",
"CMAKE_CXX_FLAGS_DEBUG": "$env{DEBUG_CXXFLAGS}",
"CMAKE_CXX_FLAGS_RELEASE": "$env{CXXFLAGS}",
"CMAKE_C_COMPILER": "$env{CC}",
"CMAKE_C_FLAGS_DEBUG": "$env{DEBUG_CFLAGS}",
"CMAKE_C_FLAGS_RELEASE": "$env{CFLAGS}",
"CMAKE_EXE_LINKER_FLAGS": "$env{LDFLAGS}",
"CMAKE_Fortran_COMPILER": "$env{FC}",
"CMAKE_Fortran_FLAGS_DEBUG": "$env{DEBUG_FORTRANFLAGS}",
"CMAKE_Fortran_FLAGS_RELEASE": "$env{FORTRANFLAGS}",
"CMAKE_INSTALL_LIBDIR": "lib",
"CMAKE_INSTALL_PREFIX": "$env{CONDA_PREFIX}",
"CMAKE_LINKER": "$env{LD}",
"CMAKE_PREFIX_PATH": "$env{CONDA_PREFIX}",
"CMAKE_RANLIB": "$env{RANLIB}",
"CMAKE_STRIP": "$env{STRIP}"
},
"description": "Base profile using conda libraries and compilers on Unix",
"displayName": "Conda Unix",
"hidden": true,
"name": "conda-unix"
},
{
"cacheVariables": {
"CMAKE_AR": "$env{GCC_AR}",
"CMAKE_CXX_COMPILER": "$env{GXX}",
"CMAKE_C_COMPILER": "$env{GCC}",
"CMAKE_Fortran_COMPILER": "$env{GFORTRAN}",
"CMAKE_LINKER": "$env{LD_GOLD}",
"CMAKE_RANLIB": "$env{GCC_RANLIB}"
},
"description": "Base profile using conda libraries and GNU compilers",
"displayName": "Conda GNU",
"hidden": true,
"inherits": [
"conda-unix"
],
"name": "conda-gnu"
},
{
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang",
"CMAKE_Fortran_COMPILER": "lfortran",
"CMAKE_LINKER": "lld"
},
"description": "Base profile using conda libraries and LLVM compilers",
"displayName": "Conda Clang",
"hidden": true,
"inherits": [
"conda-unix"
],
"name": "conda-llvm"
},
{
"cacheVariables": {
"BUILD_LIBMAMBA": "ON",
"BUILD_LIBMAMBAPY": "ON",
"BUILD_LIBMAMBA_TESTS": "ON",
"BUILD_MAMBA_PACKAGE": "ON",
"BUILD_MICROMAMBA": "ON",
"BUILD_MICROMAMBA_SERVER": "ON"
},
"description": "Base profile for building everything in Mamba",
"displayName": "Mamba All",
"hidden": true,
"name": "mamba-all"
},
{
"cacheVariables": {
"BUILD_SHARED": "ON"
},
"hidden": true,
"name": "mamba-shared"
},
{
"cacheVariables": {
"BUILD_STATIC": "ON"
},
"hidden": true,
"name": "mamba-static"
},
{
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"hidden": true,
"name": "mamba-debug"
},
{
"cacheVariables": {
"CMAKE_COLOR_DIAGNOSTICS": "ON",
"CMAKE_COLOR_MAKEFILE": "ON",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_CXX_STANDARD": "17",
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"description": "Extra convenience flags used when developping",
"displayName": "Mamba Dev",
"hidden": true,
"name": "mamba-dev",
"warnings": {
"dev": true,
"unusedCli": true
}
},
{
"displayName": "Mamba Unix Shared Debug Dev",
"displayName": "Mamba Unix Shared Debug",
"inherits": [
"conda-unix",
"mamba-all",
"mamba-shared",
"mamba-debug",
"mamba-debug"
],
"name": "mamba-unix-shared-debug"
},
{
"displayName": "Mamba Unix Shared Release",
"inherits": [
"conda-unix",
"mamba-all",
"mamba-shared",
"mamba-release"
],
"name": "mamba-unix-shared-release"
},
{
"displayName": "Mamba Unix Shared Debug Dev",
"inherits": [
"mamba-unix-shared-debug",
"mamba-dev"
],
"name": "mamba-unix-shared-debug-dev"
},
{
"displayName": "Mamba Win Shared Release",
"inherits": [
"mamba-all",
"mamba-shared",
"mamba-release"
],
"name": "mamba-win-shared-release"
}
],
"include": [
"dev/CMakePresetsUnix.json",
"dev/CMakePresetsMamba.json"
],
"version": 4
}

View File

@ -0,0 +1,67 @@
{
"configurePresets": [
{
"cacheVariables": {
"BUILD_LIBMAMBA": "ON",
"BUILD_LIBMAMBAPY": "ON",
"BUILD_LIBMAMBA_TESTS": "ON",
"BUILD_MAMBA_PACKAGE": "ON",
"BUILD_MICROMAMBA": "ON",
"BUILD_MICROMAMBA_SERVER": "ON"
},
"description": "Base profile for building everything in Mamba",
"displayName": "Mamba All",
"hidden": true,
"name": "mamba-all"
},
{
"cacheVariables": {
"BUILD_SHARED": "ON"
},
"hidden": true,
"name": "mamba-shared"
},
{
"cacheVariables": {
"BUILD_STATIC": "ON"
},
"hidden": true,
"name": "mamba-static"
},
{
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
},
"hidden": true,
"name": "mamba-debug"
},
{
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
},
"hidden": true,
"name": "mamba-release"
},
{
"cacheVariables": {
"CMAKE_COLOR_DIAGNOSTICS": "ON",
"CMAKE_COLOR_MAKEFILE": "ON",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_CXX_STANDARD": "17",
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
},
"description": "Extra convenience flags used when developping",
"displayName": "Mamba Dev",
"hidden": true,
"name": "mamba-dev",
"warnings": {
"dev": true,
"unusedCli": true
}
}
],
"version": 4
}

62
dev/CMakePresetsUnix.json Normal file
View File

@ -0,0 +1,62 @@
{
"configurePresets": [
{
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_AR": "$env{AR}",
"CMAKE_CXX_COMPILER": "$env{CXX}",
"CMAKE_CXX_FLAGS_DEBUG": "$env{DEBUG_CXXFLAGS}",
"CMAKE_CXX_FLAGS_RELEASE": "$env{CXXFLAGS}",
"CMAKE_C_COMPILER": "$env{CC}",
"CMAKE_C_FLAGS_DEBUG": "$env{DEBUG_CFLAGS}",
"CMAKE_C_FLAGS_RELEASE": "$env{CFLAGS}",
"CMAKE_EXE_LINKER_FLAGS": "$env{LDFLAGS}",
"CMAKE_Fortran_COMPILER": "$env{FC}",
"CMAKE_Fortran_FLAGS_DEBUG": "$env{DEBUG_FORTRANFLAGS}",
"CMAKE_Fortran_FLAGS_RELEASE": "$env{FORTRANFLAGS}",
"CMAKE_INSTALL_LIBDIR": "lib",
"CMAKE_INSTALL_PREFIX": "$env{CONDA_PREFIX}",
"CMAKE_LINKER": "$env{LD}",
"CMAKE_PREFIX_PATH": "$env{CONDA_PREFIX}",
"CMAKE_RANLIB": "$env{RANLIB}"
},
"description": "Base profile using conda libraries and compilers on Unix",
"displayName": "Conda Unix",
"hidden": true,
"name": "conda-unix"
},
{
"cacheVariables": {
"CMAKE_AR": "$env{GCC_AR}",
"CMAKE_CXX_COMPILER": "$env{GXX}",
"CMAKE_C_COMPILER": "$env{GCC}",
"CMAKE_Fortran_COMPILER": "$env{GFORTRAN}",
"CMAKE_LINKER": "$env{LD_GOLD}",
"CMAKE_RANLIB": "$env{GCC_RANLIB}"
},
"description": "Base profile using conda libraries and GNU compilers",
"displayName": "Conda GNU",
"hidden": true,
"inherits": [
"conda-unix"
],
"name": "conda-gnu"
},
{
"cacheVariables": {
"CMAKE_CXX_COMPILER": "clang++",
"CMAKE_C_COMPILER": "clang",
"CMAKE_Fortran_COMPILER": "lfortran",
"CMAKE_LINKER": "lld"
},
"description": "Base profile using conda libraries and LLVM compilers",
"displayName": "Conda Clang",
"hidden": true,
"inherits": [
"conda-unix"
],
"name": "conda-llvm"
}
],
"version": 4
}

View File

@ -4,6 +4,7 @@ dependencies:
# libmamba build dependencies
- cxx-compiler
- cmake >=3.16
- pkg-config # Used by some CMake dependencies
- ninja
# libmamba dependencies
- cpp-expected
@ -29,6 +30,7 @@ dependencies:
- pytest-lazy-fixture
- pytest-xprocess
- sel(win): pywin32
- conda-build # Used in legacy CI tests for `conda index`
- conda-content-trust
- conda-package-handling
- cryptography<40.0 # Or breaks conda-content-trust

View File

@ -35,6 +35,7 @@
#include "mamba/core/util_os.hpp"
#include "mamba/core/validate.hpp"
#include "mamba/core/virtual_packages.hpp"
#include "mamba/specs/version.hpp"
#include "mamba/util/flat_set.hpp"
#include "mamba/util/string.hpp"
@ -261,6 +262,11 @@ PYBIND11_MODULE(bindings, m)
{
using namespace mamba;
py::class_<specs::Version>(m, "Version")
.def_static("parse", &specs::Version::parse)
.def("__str__", &specs::Version::str);
// declare earlier to avoid C++ types in docstrings
auto pyChannel = py::class_<Channel, std::unique_ptr<Channel, py::nodelete>>(m, "Channel");
auto pyPackageInfo = py::class_<PackageInfo>(m, "PackageInfo");

View File

@ -0,0 +1,7 @@
import libmambapy
def test_version():
ver_str = "1.0"
ver = libmambapy.bindings.Version.parse(ver_str)
assert str(ver) == ver_str

View File

@ -1,28 +1,21 @@
import json
import os
import re
import shutil
import subprocess
import sys
from pathlib import Path
import pytest
if not sys.platform.startswith("win"):
pytest.skip("skipping windows-only tests", allow_module_level=True)
import menuinst
import win32com.client
from .helpers import create, get_env, get_umamba, random_string, remove, umamba_list
if sys.platform.startswith("win"):
import menuinst
import win32com.client
class TestMenuinst:
root_prefix = os.environ["MAMBA_ROOT_PREFIX"]
current_prefix = os.environ["CONDA_PREFIX"]
dirs = menuinst.win32.dirs_src
@classmethod
def setup_class(cls):
pass
@ -31,12 +24,16 @@ class TestMenuinst:
def teardown_class(cls):
pass
@pytest.mark.skipif(
not sys.platform.startswith("win"),
reason="skipping windows-only tests",
)
def test_simple_shortcut(self):
env_name = random_string()
# "--json"
create("miniforge_console_shortcut=1.0", "-n", env_name, no_dry_run=True)
prefix = os.path.join(self.root_prefix, "envs", env_name)
d = self.dirs["user"]["start"][0]
d = menuinst.win32.dirs_src["user"]["start"][0]
lnk = os.path.join(d, "Miniforge", "Miniforge Prompt (" + env_name + ").lnk")
assert os.path.exists(lnk)
@ -60,6 +57,10 @@ class TestMenuinst:
remove("miniforge_console_shortcut", "-n", env_name, no_dry_run=True)
assert not os.path.exists(lnk)
@pytest.mark.skipif(
not sys.platform.startswith("win"),
reason="skipping windows-only tests",
)
def test_shortcut_weird_env(self):
# note Umlauts do not work yet
os.environ["MAMBA_ROOT_PREFIX"] = str(Path("./compl i c ted").absolute())
@ -69,7 +70,7 @@ class TestMenuinst:
# "--json"
create("miniforge_console_shortcut=1.0", "-n", env_name, no_dry_run=True)
prefix = os.path.join(root_prefix, "envs", env_name)
d = self.dirs["user"]["start"][0]
d = menuinst.win32.dirs_src["user"]["start"][0]
lnk = os.path.join(d, "Miniforge", "Miniforge Prompt (" + env_name + ").lnk")
assert os.path.exists(lnk)