aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2020-04-21 00:37:34 +0300
committerGitHub <noreply@github.com>2020-04-21 00:37:34 +0300
commit84f28fc3f16fc46f792da94ffb572cc043c7ad2c (patch)
tree6b86c392ef449cdffab4c1b925d610a1e7b436bb /run_unittests.py
parent89bd55b9da6675d17bd4431aed99354603a7b312 (diff)
parenteb45ce6189870181b9d8a8eb07cfeab55a0ed012 (diff)
downloadmeson-84f28fc3f16fc46f792da94ffb572cc043c7ad2c.zip
meson-84f28fc3f16fc46f792da94ffb572cc043c7ad2c.tar.gz
meson-84f28fc3f16fc46f792da94ffb572cc043c7ad2c.tar.bz2
Merge pull request #6816 from dcbaker/framework-matrix
project test junit schema + a few more uses
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py
index d65f169..831e53f 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -1227,6 +1227,32 @@ class InternalTests(unittest.TestCase):
actual = [m() for m in f(env, MachineChoice.HOST, {'required': False})]
self.assertListEqual([m.type_name for m in actual], ['cmake', 'pkgconfig'])
+ def test_validate_json(self) -> None:
+ """Validate the json schema for the test cases."""
+ try:
+ from jsonschema import validate, ValidationError
+ except ImportError:
+ if is_ci():
+ raise
+ raise unittest.SkipTest('Python jsonschema module not found.')
+
+ with Path('data/test.schema.json').open() as f:
+ schema = json.load(f)
+
+ errors = [] # type: T.Tuple[str, Exception]
+ for p in Path('test cases').glob('**/test.json'):
+ with p.open() as f:
+ try:
+ validate(json.load(f), schema=schema)
+ except ValidationError as e:
+ errors.append((p.resolve(), e))
+
+ for f, e in errors:
+ print('Failed to validate: "{}"'.format(f))
+ print(str(e))
+
+ self.assertFalse(errors)
+
@unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
class DataTests(unittest.TestCase):