def test_dynamic_schemas_against_generated(self):
     """This test checks that previously generated schemas haven't changed
     by later modifications to the Python definitions.
     When you define new schemas or new versions of schemas, you'll need
     to run data/schemas/generate.py to get them generated.
     """
     all_schemas = load_all_server_schemas()
     test_library = BundledSchemaLibrary(self.schemas_path, __package__)
     for ref, schema in all_schemas.items():
         assert test_library.load_schema(ref) == schema
 def test_bundled_schema_lookup(self, tmpdir):
     pkgdir = tmpdir.mkdir(tmpdir.basename)
     pkgdir.ensure("__init__.py")
     schemadir = pkgdir.mkdir("schemas")
     module = pkgdir.pyimport()
     library = BundledSchemaLibrary("schemas", module.__name__)
     requested_schema = SchemaRef("example", "1-0-0")
     with pytest.raises(SchemaLookupError):
         library.load_schema(requested_schema)
     schema_path = schemadir.join("example-v1-0-0.schema.json")
     dummy_schema = {"dummy-schema": "example"}
     serialized_schema = json.dumps(dummy_schema).encode('utf-8')
     schema_path.write_binary(serialized_schema)
     assert library.read_binary_schema(
         requested_schema) == serialized_schema
     assert library.load_schema(requested_schema) == dummy_schema