From 4bb4fcf01187e247fb9d7fe06a5c3f9408122071 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Wed, 30 Apr 2025 16:52:05 +0100 Subject: [PATCH] Fixes #18: Adds support for 'py -V:default' --- src/manage/installs.py | 3 ++- tests/test_commands.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/manage/installs.py b/src/manage/installs.py index 869ba48..debd0d2 100644 --- a/src/manage/installs.py +++ b/src/manage/installs.py @@ -247,13 +247,14 @@ def get_install_to_run( if not installs: raise NoInstallsError - if not tag: + if not tag or tag.casefold() == "default".casefold(): # We know we want default, so try filtering first. If any are explicitly # tagged (e.g. active venv), they will be the only candidates. # Otherwise, we'll do a regular search as if 'default_tag' was provided. default_installs = [i for i in installs if i.get("default")] if default_installs: installs = default_installs + tag = None else: tag = tag_or_range(default_tag) used_default = True diff --git a/tests/test_commands.py b/tests/test_commands.py index 83ed443..d942597 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -17,3 +17,8 @@ def test_help_with_error_command(assert_log, monkeypatch): r"Python installation manager \d+\.\d+.*", assert_log.skip_until(rf"The command .*?pymanager-test {expect} -v -q.*"), ) + + +def test_exec_with_literal_default(): + cmd = commands.load_default_config(None) + assert cmd.get_install_to_run("default", None)