Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d5ef4c6

Browse files
committedMay 30, 2025·
Test make-variant with invalid properties
1 parent c53c860 commit d5ef4c6

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
 
Binary file not shown.

‎tests/commands/test_make_variant.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from tests.utils import assert_zips_equal
88
from variantlib.commands.main import main
9+
from variantlib.validators.base import ValidationError
910

1011

1112
@pytest.fixture
@@ -74,3 +75,49 @@ def test_make_variant(
7475
Path("tests/artifacts/test_plugin_package-0-py3-none-any-5d8be4b9.whl"),
7576
tmp_path / "test_plugin_package-0-py3-none-any-5d8be4b9.whl",
7677
)
78+
79+
80+
def test_make_variant_invalid(
81+
test_plugin_package_wheel_path: Path,
82+
pyproject_toml: Path,
83+
tmp_path: Path,
84+
) -> None:
85+
with pytest.raises(ValidationError):
86+
main(
87+
[
88+
"make-variant",
89+
"-f",
90+
str(test_plugin_package_wheel_path),
91+
"-o",
92+
str(tmp_path),
93+
"--pyproject-toml",
94+
str(pyproject_toml),
95+
"-p",
96+
"foo::bar::baz",
97+
]
98+
)
99+
100+
101+
def test_make_variant_no_validate(
102+
test_plugin_package_wheel_path: Path,
103+
pyproject_toml: Path,
104+
tmp_path: Path,
105+
) -> None:
106+
main(
107+
[
108+
"make-variant",
109+
"-f",
110+
str(test_plugin_package_wheel_path),
111+
"-o",
112+
str(tmp_path),
113+
"--pyproject-toml",
114+
str(pyproject_toml),
115+
"--skip-plugin-validation",
116+
"-p",
117+
"foo::bar::baz",
118+
]
119+
)
120+
assert_zips_equal(
121+
Path("tests/artifacts/test_plugin_package-0-py3-none-any-ac31c899.whl"),
122+
tmp_path / "test_plugin_package-0-py3-none-any-ac31c899.whl",
123+
)

‎tests/commands/test_unmake_variant.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
[
1717
"test_plugin_package-0-py3-none-any-00000000.whl",
1818
"test_plugin_package-0-py3-none-any-5d8be4b9.whl",
19+
"test_plugin_package-0-py3-none-any-ac31c899.whl",
1920
],
2021
)
2122
def test_unmake_variant(

0 commit comments

Comments
 (0)
Please sign in to comment.