From 187ac96ceae4eeab878b74e401c0d0fc6b38a84f Mon Sep 17 00:00:00 2001 From: Tim Paine <3105306+timkpaine@users.noreply.github.com> Date: Fri, 13 Nov 2026 19:51:34 -0500 Subject: [PATCH] Pass arguments for unsupported fields in the model test The test expected p2a to warn about each field it cannot expose. A p2a change prints those warnings only when an argument for the field is passed. Passing the arguments produces the warnings with both the released p2a and the new one. Signed-off-by: Tim Paine <3105306+timkpaine@users.noreply.github.com> --- hatch_build/tests/test_cli_model.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hatch_build/tests/test_cli_model.py b/hatch_build/tests/test_cli_model.py index 70456f3..4315548 100644 --- a/hatch_build/tests/test_cli_model.py +++ b/hatch_build/tests/test_cli_model.py @@ -131,6 +131,13 @@ def test_get_arg_from_model(self): "z", "--submodel-dict-instanced.a.sub-arg", "500", + # p2a warns about a field it cannot expose when an argument for it is passed + "--unsupported-submodel-list.0.sub-arg=1", + "--unsupported-submodel-dict.a.sub-arg=1", + "--unsupported-literal=x", + "--unsupported-dict=a=b", + "--unsupported-dict-mixed-types=a=b", + "--unsupported-random-type=x", ], ), patch("sys.stderr", new_callable=StringIO) as mock_stderr, @@ -139,7 +146,7 @@ def test_get_arg_from_model(self): assert hatchling() == 0 model, extras = parse_extra_args_model(MyTopLevelModel(submodel=SubModel())) - assert len(extras) == 1 + assert len(extras) == 7 assert "--extra-arg-not-in-parser" in extras assert model.extra_arg is True