Re: [SQLObject] Python 2.7.12 + tox + PostgreSQL
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Oleg B. <ph...@ph...> - 2016-10-27 19:28:11
|
On Thu, Oct 27, 2016 at 09:10:49PM +0200, Neil Muller <drn...@gm...> wrote:
> On 23 September 2016 at 00:03, Oleg Broytman <ph...@ph...> wrote:
> > Hi, all!
> >
> > On Thu, Aug 25, 2016 at 11:18:45PM +0200, Oleg Broytman <ph...@ph...> wrote:
> >> Recently tests started to fail both at Travis and Circle, but only
> >> with Postgres. Initially I couldn't reproduce the problem locally but
> >> after a dozen of experiments I got it: the problem manifests itself
> >> only with Python 2.7.12 + tox + PostgreSQL. I have to install Python
> >> 2.7.12 and tox to reproduce it locally (I have Debian with Python 2.7.9
> >> and I usually don't use tox - I run py.test directly).
> >>
> >> Somehow I managed to fix tests by changing test order - I explicitly
> >> listed tests directories with 'tests' at the top of the other dirs.
> >
> > After a few hundreds successful and failed test runs I narrowed the
> > problem a bit and reproduced it with any python version and without tox.
> > So the problem is clearly in SQLObject tests.
> > The problem is manifested if tests from sqlobject/tests are run after
> > sqlobject/inheritance/tests:
> >
> > createdb test
> > py.test sqlobject/inheritance/tests tests/test_schema.py
> > dropdb test
> >
>
> I spent some time today poking at this. While I haven't isolated the
> cause, I have some more information on what's happening.
>
> When the test fails, the connection pool has two entries. Because of
> how getConnection & releaseConnection are implemented, the connection
> returned by getConnection will cycle between these two entries. In
> this case, the call to CREATE TABLE and the query end up happening in
> different connections, which have different values for search_path
> (since that's local to the underlying connection), which causes the
> failure.
>
> I haven't worked out where the extra connection in the pool gets
> created or why this only happens some of the time.
Food for thoughts. Thanks!
> --
> Neil Muller
> drn...@gm...
Oleg.
--
Oleg Broytman http://phdru.name/ ph...@ph...
Programmers don't die, they just GOSUB without RETURN.
|