Skip to content

Commit 1db2417

Browse files
authored
Fixes #18: Adds support for 'py -V:default' (#38)
1 parent 71c035b commit 1db2417

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/manage/installs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,14 @@ def get_install_to_run(
247247
if not installs:
248248
raise NoInstallsError
249249

250-
if not tag:
250+
if not tag or tag.casefold() == "default".casefold():
251251
# We know we want default, so try filtering first. If any are explicitly
252252
# tagged (e.g. active venv), they will be the only candidates.
253253
# Otherwise, we'll do a regular search as if 'default_tag' was provided.
254254
default_installs = [i for i in installs if i.get("default")]
255255
if default_installs:
256256
installs = default_installs
257+
tag = None
257258
else:
258259
tag = tag_or_range(default_tag)
259260
used_default = True

tests/test_commands.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,8 @@ def test_help_with_error_command(assert_log, monkeypatch):
1717
r"Python installation manager \d+\.\d+.*",
1818
assert_log.skip_until(rf"The command .*?pymanager-test {expect} -v -q.*"),
1919
)
20+
21+
22+
def test_exec_with_literal_default():
23+
cmd = commands.load_default_config(None)
24+
assert cmd.get_install_to_run("default", None)

0 commit comments

Comments
 (0)