File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,16 @@ def __init__(
108108 if python_version is None :
109109 self ._python_version = None
110110 else :
111- self ._python_version = tuple (map (int , python_version .split ("." )))
111+ # Handle non released Python versions e.g. release candidates
112+ version_match = re .match (r"(\d+)\.(\d+)\.?(\d+)?" , python_version )
113+ if version_match :
114+ self ._python_version = tuple (
115+ int (each ) for each in version_match .groups () if each is not None
116+ )
117+ else :
118+ raise ValueError (
119+ f"{ python_version = } does not look like a valid Python version"
120+ )
112121
113122 if system == "osx" :
114123 self ._sys_platform = "darwin"
Original file line number Diff line number Diff line change @@ -3577,3 +3577,25 @@ def test_update_with_changed_channels_raises_error(
35773577 assert "defaults" in error_msg
35783578 assert "conda-forge" in error_msg
35793579 assert "without the --update flag" in error_msg
3580+
3581+
3582+ def test_conda_lock_python_release_candidate_with_pip_section (
3583+ tmp_path : Path , conda_exe : str
3584+ ) -> None :
3585+ # Create a simple environment file
3586+ environment_yml = tmp_path / "environment.yml"
3587+ environment_yml .write_text ("""
3588+ channels:
3589+ - conda-forge
3590+ - conda-forge/label/python_rc
3591+ dependencies:
3592+ - python=3.14.0rc2
3593+ - pip
3594+ - pip:
3595+ - simplejson
3596+ """ )
3597+ run_lock (
3598+ [environment_yml ],
3599+ conda_exe = conda_exe ,
3600+ mapping_url = DEFAULT_MAPPING_URL ,
3601+ )
You can’t perform that action at this time.
0 commit comments