Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Added tests to show that pip works correctly
  • Loading branch information
gauravsaini04 committed Feb 16, 2024
commit 54d5d89245de5db2848b09640f30c3ad6e7761f1
26 changes: 26 additions & 0 deletions src/miniconda/test-project/test-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,29 @@ checkCondaPackageVersion()
current_version=$(conda list "${PACKAGE}" | grep -E "^${PACKAGE}\s" | awk '{print $2}')
check-version-ge "conda-${PACKAGE}-requirement" "${current_version}" "${REQUIRED_VERSION}"
}

# Function to check if a package is installed
checkPackageInstalled() {
if python -c "import $1" &>/dev/null; then
echo -e "\n✅ Passed! \n$1 is installed"
else
echo -e "$1 is NOT installed\n"
echoStderr "❌ check failed."
fi
}

# Function to install a package using pip
installPackage() {
python3 -m pip install "$1"
}

checkPipWorkingCorrectly() {
# List of packages to install via pip
packages=("numpy" "requests" "matplotlib")
# Install packages and check if installation was successful
for package in "${packages[@]}"; do
echo -e "\n🧪 Testing pip install $package\n"
installPackage "$package"
checkPackageInstalled "$package"
done
}
2 changes: 2 additions & 0 deletions src/miniconda/test-project/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@ check "conda-update-conda" bash -c "conda update -y conda"
check "conda-install-tensorflow" bash -c "conda create --name test-env -c conda-forge --yes tensorflow"
check "conda-install-pytorch" bash -c "conda create --name test-env -c conda-forge --yes pytorch"

checkPipWorkingCorrectly

# Report result
reportResults