Re: [pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Mike Orr
One thing to watch with Postgresql databases in testing is, autoincrement primary keys do *not* roll back. So on the first test run the new records may start with 1, but on later runs they may start with 10,000 or some other absurdly high number, even though the insertions are always rolled back

Re: [pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Mike Orr
On Thu, Jun 24, 2021 at 10:34 AM Zsolt Ero wrote: > > Hi, > > I have my webtest based testing set up like the following. > > @pytest.fixture(scope="session") > def app(): > testing_config = { > 'sqlalchemy.url': 'postgresql+psycopg2://x@/x', > 'redis.sessions.secret': 'x', #

Re: [pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Michael Merickel
If you have the app, the registry is attached as "app.registry" and you can use the underlying prepare() method with it, same as bootstrap does. See https://docs.pylonsproject.org/projects/pyramid/en/latest/api/scripting.html#pyramid.scripting.prepare

[pylons-discuss] modifying database in webtest based testing

2021-06-24 Thread Zsolt Ero
Hi, I have my webtest based testing set up like the following. @pytest.fixture(scope="session") def app(): testing_config = { 'sqlalchemy.url': 'postgresql+psycopg2://x@/x', 'redis.sessions.secret': 'x', # random string 'redis.sessions.db': 1,