[LNT] r248789 - Fix postgres unit tests by closing db connections.

Kristof Beyls via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 09:15:09 PDT 2015


Thanks for catching this Adam!

This is now fixed in r249697. I've also added a regression test for
this functionality, so it should be harder to break this in the future.

Kristof

> -----Original Message-----
> From: anemet at apple.com [mailto:anemet at apple.com]
> Sent: 08 October 2015 07:28
> To: Kristof Beyls
> Cc: llvm-commits at lists.llvm.org
> Subject: Re: [LNT] r248789 - Fix postgres unit tests by closing db
> connections.
> 
> 
> > Modified: lnt/trunk/lnt/util/ServerUtil.py
> > URL:
> > http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/util/ServerUtil.py?r
> > ev=248789&r1=248788&r2=248789&view=diff
> > ======================================================================
> > ========
> > --- lnt/trunk/lnt/util/ServerUtil.py (original)
> > +++ lnt/trunk/lnt/util/ServerUtil.py Tue Sep 29 06:49:15 2015
> > @@ -45,11 +45,12 @@ def submitFileToInstance(path, file, com
> >     instance = lnt.server.instance.Instance.frompath(path)
> >     config = instance.config
> >     db_name = 'default'
> > -    db = config.get_database(db_name)
> > -    if db is None:
> > -        raise ValueError("no default database in instance: %r" %
> (path,))
> > -    return lnt.util.ImportData.import_and_report(
> > -        config, db_name, db, file, format='<auto>', commit=commit)
> > +    with closing(config.get_database(db_name)) as db:
> > +        if db is None:
> > +            raise ValueError("no default database in instance: %r" %
> (path,))
> > +        return lnt.util.ImportData.import_and_report(
> > +            config, db_name, db, file, format='<auto>',
> > + commit=commit)
> > +
> 
> Hi Kristof,
> 
> Isn’t this missing “import contextlib” and contextlib.closing later?
> 
> Adam




More information about the llvm-commits mailing list