Skip to content

Commit

Permalink
Add tests on conda and mamba usage
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Jerphanion <[email protected]>
  • Loading branch information
jjerphan committed Jan 20, 2025
1 parent e682bd6 commit bbcf282
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,28 @@ EOF
conda list
fi

echo "+ Mamba does not warn (check that there is no warning on stderr)"
mamba --help 2> stderr.log
test ! -s stderr.log
rm -f stderr.log

echo "+ mamba info"
mamba info

echo "+ mamba config sources"
mamba config sources

echo "+ mamba config list"
mamba config list

echo "+ Testing mamba 2.0.5 version"
mamba info --json | python -c "import sys, json; info = json.loads(sys.stdin.read()); assert info['mamba version'] == '2.0.5', info"
echo " OK"

echo "+ Testing mamba channels"
mamba info --json | python -c "import sys, json; info = json.loads(sys.stdin.read()); assert any('conda-forge' in c for c in info['channels']), info"
echo " OK"

echo "***** Python path *****"
python -c "import sys; print(sys.executable)"
python -c "import sys; assert 'miniforge' in sys.executable"
Expand All @@ -84,3 +106,39 @@ python -c "import platform; print(platform.machine())"
python -c "import platform; print(platform.release())"

echo "***** Done: Testing installer *****"

echo "***** Testing the usage of mamba main command *****"

echo "***** Create a new environment *****"
mamba create -n testenv numpy --yes

echo "***** Activate the environment with mamba *****"
mamba activate testenv

echo "***** Check that numpy is installed with mamba list *****"
mamba list | grep numpy

echo "***** Deactivate the environment *****"
mamba deactivate

echo "***** Activate the environment with conda *****"
conda activate testenv

echo "***** Check that numpy is installed with python *****"
python -c "import numpy; print(numpy.__version__)"

echo "***** Remove numpy *****"
mamba remove numpy --yes

echo "***** Check that numpy is not installed with mamba list *****"
mamba list | grep -v numpy


echo "***** Deactivate the environment with conda *****"
conda deactivate

echo "***** Remove the environment *****"
mamba env remove -n testenv --yes

echo "***** Done: Testing mamba main command *****"

0 comments on commit bbcf282

Please sign in to comment.