fix: require the jsonschema format checkers

This commit is contained in:
Abdessamad Derraz committed 2026-10-06 09:45:25 +02:00
1 parent a0af1b141e
commit d610aad990
7 files changed
+59 -5

No files matched your search

+20
View File
@@ -570,6 +570,26 @@ class PipelineRegressions(unittest.TestCase):
self.assertTrue(full_models, truth_runs)
class SchemaFormatsAreChecked(unittest.TestCase):
"""date-time and uri need jsonschema's format extras; without them the
published format constraints were accepted unread."""
@unittest.skipUnless(HAS_JSONSCHEMA, "validating a schema needs jsonschema")
def test_a_missing_checker_is_named(self):
import validate_schemas
empty = mock.Mock(checkers={})
with mock.patch.object(validate_schemas, "FormatChecker", return_value=empty):
self.assertEqual(validate_schemas.unchecked_formats(), ["date-time", "uri"])
def test_every_install_asks_for_the_extras(self):
for path in (".github/workflows/validate.yml", ".github/workflows/deploy-site.yml",
"pyproject.toml"):
text = (ROOT / path).read_text(encoding="utf-8")
with self.subTest(path=path):
self.assertNotRegex(text, r"jsonschema(?!\[format)[=>]")
class ResolverRegressions(unittest.TestCase):
def _database(self, entries: dict[str, Path], suffix: str | None = None) -> dict:
files = {}
+8
View File
@@ -318,5 +318,13 @@ class RepeatedDestinations(unittest.TestCase):
self.assertEqual(diff.files_changed, ["pce/syscard3.pce"])
class PinsWithExtras(unittest.TestCase):
def test_an_extras_bracket_keeps_its_pin(self):
from check_freshness import parse_pip_pins # noqa: PLC0415
pins = parse_pip_pins(' run: pip install pyyaml "jsonschema[format-nongpl]==4.26.0"')
self.assertEqual(pins["jsonschema"], "==4.26.0")
if __name__ == "__main__":
unittest.main()