python: fix fd leak in generator.py
[libvirt-python/ericb.git] / sanitytest.py
blobace67929ac36e81a8cb9f1663286c902b3368f49
1 #!/usr/bin/python
3 import libvirt
5 globals = dir(libvirt)
7 # Sanity test that the generator hasn't gone wrong
9 # Look for core classes
10 for clsname in ["virConnect",
11 "virDomain",
12 "virDomainSnapshot",
13 "virInterface",
14 "virNWFilter",
15 "virNodeDevice",
16 "virNetwork",
17 "virSecret",
18 "virStoragePool",
19 "virStorageVol",
20 "virStream",
22 assert(clsname in globals)
23 assert(object in getattr(libvirt, clsname).__bases__)
25 # Constants
26 assert("VIR_CONNECT_RO" in globals)
28 # Error related bits
29 assert("libvirtError" in globals)
30 assert("VIR_ERR_AUTH_FAILED" in globals)
31 assert("virGetLastError" in globals)
33 # Some misc methods
34 assert("virInitialize" in globals)
35 assert("virEventAddHandle" in globals)
36 assert("virEventRegisterDefaultImpl" in globals)