[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Check if classes are derived from object



On Mon, Feb 11, 2013 at 04:24:15PM +0000, Daniel P. Berrange wrote:
> On Mon, Feb 11, 2013 at 05:20:31PM +0100, Guido Günther wrote:
> > This makes sure we don't regress to old style classes
> > ---
> > Just a minor addition that came up while verifying if the corresponding
> > Debian bug is fixed.
> > 
> >  python/sanitytest.py |   27 ++++++++++++++++-----------
> >  1 file changed, 16 insertions(+), 11 deletions(-)
> > 
> > diff --git a/python/sanitytest.py b/python/sanitytest.py
> > index 047450b..ace6792 100644
> > --- a/python/sanitytest.py
> > +++ b/python/sanitytest.py
> > @@ -7,17 +7,22 @@ globals = dir(libvirt)
> >  # Sanity test that the generator hasn't gone wrong
> >  
> >  # Look for core classes
> > -assert("virConnect" in globals)
> > -assert("virDomain" in globals)
> > -assert("virDomainSnapshot" in globals)
> > -assert("virInterface" in globals)
> > -assert("virNWFilter" in globals)
> > -assert("virNodeDevice" in globals)
> > -assert("virNetwork" in globals)
> > -assert("virSecret" in globals)
> > -assert("virStoragePool" in globals)
> > -assert("virStorageVol" in globals)
> > -assert("virStream" in globals)
> > +for clsname in ["virConnect",
> > +                "virDomain",
> > +                "virDomainSnapshot",
> > +                "virInterface",
> > +                "virNWFilter",
> > +                "virNodeDevice",
> > +                "virNetwork",
> > +                "virSecret",
> > +                "virStoragePool",
> > +                "virStorageVol",
> > +                "virStream",
> > +                ]:
> > +    assert(clsname in globals)
> > +    assert(object in getattr(libvirt, clsname).__bases__)
> > +
> > +# Constants
> >  assert("VIR_CONNECT_RO" in globals)
> 
> ACK, good idea.
Pushed. Thanks,
 -- Guido


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]