mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
test ensure_user_environment
verify behavior for: - current version (no change) - old, supported version (upgrade, but not too far) - too old, re-run installer - directory exists, no conda
This commit is contained in:
@@ -96,7 +96,7 @@ def download_miniconda_installer(installer_url, sha256sum):
|
||||
t = time.perf_counter() - tic
|
||||
logger.info(f"Downloaded conda installer {installer_url} in {t:.1f}s")
|
||||
|
||||
if sha256_file(f.name) != sha256sum:
|
||||
if sha256sum and sha256_file(f.name) != sha256sum:
|
||||
raise Exception("sha256sum hash mismatch! Downloaded file corrupted")
|
||||
|
||||
yield f.name
|
||||
|
||||
@@ -224,7 +224,7 @@ def ensure_user_environment(user_requirements_txt_file):
|
||||
if not found_conda:
|
||||
if os.path.exists(USER_ENV_PREFIX):
|
||||
logger.warning(
|
||||
f"Found prefix at {USER_ENV_PREFIX}, but too old or missing conda/mamba ({have_versions}). Rebuilding env from scratch!!"
|
||||
f"Found prefix at {USER_ENV_PREFIX}, but too old or missing conda/mamba ({have_versions}). Upgrading from mambaforge."
|
||||
)
|
||||
# FIXME: should this fail? I'm not sure how destructive it is
|
||||
logger.info("Downloading & setting up user environment...")
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Miscellaneous functions useful in at least two places unrelated to each other
|
||||
"""
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
# Copied into bootstrap/bootstrap.py. Make sure these two copies are exactly the same!
|
||||
@@ -67,4 +68,6 @@ def parse_version(version_string):
|
||||
Finds all numbers and returns a tuple of ints
|
||||
_very_ loose version parsing, like the old distutils.version.LooseVersion
|
||||
"""
|
||||
return tuple(int(part) for part in version_string.split("."))
|
||||
# return a tuple of all the numbers in the version string
|
||||
# always succeeds, even if passed nonsense
|
||||
return tuple(int(part) for part in re.findall(r"\d+", version_string))
|
||||
|
||||
Reference in New Issue
Block a user