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

createdb test
py.test sqlobject/inheritance/tests tests/test_schema.py
dropdb test


sqlobject/inheritance/tests/test_aggregates.py .
sqlobject/inheritance/tests/test_asdict.py ..
sqlobject/inheritance/tests/test_deep_inheritance.py ...
sqlobject/inheritance/tests/test_foreignKey.py ..
sqlobject/inheritance/tests/test_indexes.py .
sqlobject/inheritance/tests/test_inheritance.py ....
sqlobject/inheritance/tests/test_inheritance_tree.py .
sqlobject/tests/test_schema.py F

    def test_connection_schema():
        if not supports('schema'):
            py.test.skip("schemas aren't supported")
        conn = getConnection()
        conn.schema = None
        conn.query('CREATE SCHEMA test')
        conn.schema = 'test'
        conn.query('SET search_path TO test')
        assert SOTestSchema._connection is conn
>       SOTestSchema(foo='bar')

    def _executeRetry(self, conn, cursor, query):
        if self.debug:
            self.printDebug(conn, query, 'QueryR')
            return cursor.execute(query)
        except self.module.OperationalError as e:
            raise dberrors.OperationalError(ErrorMessage(e))
        except self.module.IntegrityError as e:
            msg = ErrorMessage(e)
            if e.pgcode == '23505':
                raise dberrors.DuplicateEntryError(msg)
                raise dberrors.IntegrityError(msg)
        except self.module.InternalError as e:
            raise dberrors.InternalError(ErrorMessage(e))
        except self.module.ProgrammingError as e:
>           raise dberrors.ProgrammingError(ErrorMessage(e))
E           ProgrammingError: relation "so_test_schema" does not exist
E           LINE 1: INSERT INTO so_test_schema (foo) VALUES ('bar') RETURNING id
E                               ^

     Oleg Broytman            http://phdru.name/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

sqlobject-discuss mailing list

Reply via email to