| 12345678910111213141516171819202122232425262728293031323334 |
- """Guard the committed generated dialect against submodule drift."""
- import unittest
- from tools import gen_dialect
- from tools.gen_dialect import INCLUDES, SOURCE
- class DialectSyncTests(unittest.TestCase):
- def test_xml_sources_are_present(self):
- missing = [
- str(path)
- for path in (SOURCE, *(SOURCE.parent / name for name in INCLUDES))
- if not path.is_file()
- ]
- self.assertEqual(
- missing,
- [],
- "run `git submodule update --init --recursive` before testing",
- )
- def test_generated_dialect_is_up_to_date(self):
- if not gen_dialect.OUTPUT.is_file():
- self.fail(f"{gen_dialect.OUTPUT} is missing; run: python tools/gen_dialect.py")
- updated = gen_dialect.generate(dry_run=True, no_validate=True)
- self.assertFalse(
- updated,
- "motian_bridge/dialects/v20/VKFly.py is stale; regenerate with "
- "`.venv/bin/python tools/gen_dialect.py`",
- )
- if __name__ == "__main__":
- unittest.main()
|