Skip to content

Commit 4455a6e

Browse files
fix: write updated lock spec to file in add-wheels command (#36)
* fix: write updated lock spec to file in add-wheels command * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated failing tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fixed pre commit issues --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 45851a8 commit 4455a6e

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

pyodide_lock/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def add_wheels(
4747
4848
"""
4949
sp = PyodideLockSpec.from_json(input)
50-
add_wheels_to_spec(
50+
sp = add_wheels_to_spec(
5151
sp,
5252
wheels,
5353
base_path=base_path,

tests/test_cli.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from typer.testing import CliRunner
2+
3+
from pyodide_lock.cli import main
4+
from pyodide_lock.spec import PyodideLockSpec
5+
6+
runner = CliRunner()
7+
8+
9+
def test_add_wheels_cli_integration(tmp_path, example_lock_spec, test_wheel_list):
10+
"""Test that the CLI command correctly calls and writes output."""
11+
input_file = tmp_path / "input.json"
12+
output_file = tmp_path / "output.json"
13+
example_lock_spec.to_json(input_file)
14+
15+
result = runner.invoke(
16+
main,
17+
[
18+
str(test_wheel_list[0]),
19+
"--input",
20+
str(input_file),
21+
"--output",
22+
str(output_file),
23+
],
24+
)
25+
26+
assert result.exit_code == 0
27+
assert output_file.exists()
28+
29+
# Verify the output file contains the added wheel
30+
new_spec = PyodideLockSpec.from_json(output_file)
31+
assert "py-one" in new_spec.packages

0 commit comments

Comments
 (0)