From ab1b6ce7a1d845aa1f0fe07d0c01264e00f4c442 Mon Sep 17 00:00:00 2001 From: VAIO73 <50487331+Vaso73@users.noreply.github.com> Date: Wed, 21 Oct 2026 07:39:23 +0000 Subject: [PATCH] test: install JSON Schema validator for offline OCI regressions --- .../scripts/tests/test_oci_complete_errors_sk.py | 16 ++++++++++++++++ .github/workflows/test-i18n.yml | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/scripts/tests/test_oci_complete_errors_sk.py b/.github/scripts/tests/test_oci_complete_errors_sk.py index 8b54d976..0a6bf0d4 100644 --- a/.github/scripts/tests/test_oci_complete_errors_sk.py +++ b/.github/scripts/tests/test_oci_complete_errors_sk.py @@ -50,6 +50,22 @@ class TechnicalMessages(unittest.TestCase): self.assertTrue(raw.startswith('La plantilla generada no cumple el esquema:')) self.assertEqual(i18n.diagnostic(caught.exception), 'Vygenerovaná šablóna nezodpovedá schéme:' + raw.split(':', 1)[1]) + def test_missing_schema_validator_is_distinct_from_invalid_schema_without_effects(self): + template = {} + read = self.patch(Path, 'read_text', side_effect=AssertionError('schema must not be read without a validator')) + with patch.dict(sys.modules, {'jsonschema': None}): + with self.assertRaises(converter.ConversionError) as caught: + self.catalog.validate(template) + raw = 'python3-jsonschema is required to generate templates' + self.assertEqual(str(caught.exception), raw) + self.assertEqual(i18n.diagnostic(caught.exception), 'Na generovanie šablón je potrebný python3-jsonschema') + self.assertEqual(str(caught.exception), raw) + self.assertIsNone(self.catalog.validate(template, required=False)) + read.assert_not_called() + self.assertEqual(template, {}) + for effect in self.effects: + effect.assert_not_called() + def test_real_casaos_error_preserves_the_protocol_and_localizes_the_message(self): with self.assertRaises(converter.ConversionError) as caught: casaos.parse_casaos_compose('[]') diff --git a/.github/workflows/test-i18n.yml b/.github/workflows/test-i18n.yml index 7f4dfb51..828db33a 100644 --- a/.github/workflows/test-i18n.yml +++ b/.github/workflows/test-i18n.yml @@ -71,8 +71,8 @@ jobs: run: | test -x /bin/bash test -x /usr/bin/jq - - name: Install OCI wording test dependency - run: python3 -m pip install 'PyYAML>=6,<7' + - name: Install OCI wording test dependencies + run: python3 -m pip install 'PyYAML>=6,<7' 'jsonschema==4.25.1' - name: Run offline i18n and script regressions env: PYTHONDONTWRITEBYTECODE: '1'