Skip to content

Commit b016212

Browse files
committed
Add a missing test case for '--validator-class'
1 parent 245bf10 commit b016212

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/acceptance/test_custom_validator_class.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,28 @@ def test_custom_validator_class_can_pass_when_valid(run_line, tmp_path):
147147
],
148148
)
149149
assert result.exit_code == 0 # pass
150+
151+
152+
@pytest.mark.parametrize(
153+
"add_opts",
154+
(
155+
["--builtin-schema", "vendor.github-workflows"],
156+
["--check-metaschema"],
157+
),
158+
)
159+
def test_custom_validator_class_is_incompatible_with_schema_opts(
160+
run_line, tmp_path, add_opts
161+
):
162+
doc = tmp_path / "instance.json"
163+
doc.write_text("{}")
164+
result = run_line(
165+
[
166+
"check-jsonschema",
167+
"--validator-class",
168+
"foo:MyValidator",
169+
str(doc),
170+
]
171+
+ add_opts
172+
)
173+
assert result.exit_code == 2
174+
assert "--validator-class can only be used with --schemafile" in result.stderr

0 commit comments

Comments
 (0)