On Thu, Oct 27, 2016 at 09:10:49PM +0200, Neil Muller <drnlmuller+sqlobj...@gmail.com> wrote: > On 23 September 2016 at 00:03, Oleg Broytman <p...@phdru.name> wrote: > > Hi, all! > > > > On Thu, Aug 25, 2016 at 11:18:45PM +0200, Oleg Broytman <p...@phdru.name> > > 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 > drnlmul...@gmail.com Oleg. -- Oleg Broytman http://phdru.name/ p...@phdru.name Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy! http://sdm.link/telerik _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss