That will set your DB as being at the last version but won't apply any
migration
That is because your schema is supposed to be already at the latest version
when you run setup-app, and that should be the case as the db is created
from the models and the models should reflect the last schema version.

If you need any bootstrap data which is inserted by migrations you should
also add it from your websetup.bootstrap module which is in charge of
creating the initial data for your app.

Also keep in mind that during tests the db is created and destroyed on each
test unit, as they should all start from a reset starting point, so you are
in charge of creating the proper data on each test fixture.

If you want your db to be upgraded to latest migration you need to use
alembic.command.upgrade but that will usually break everything as is
usually impossible to apply migrations on the newly created schema which is
already the the final state.

On Thu, Sep 3, 2015 at 7:11 PM, lebouquetin <[email protected]> wrote:

> Hi all,
>
> I uses Travis-CI pour automatic tests of my Turbogears Application. The
> build fails because tests fail, because Alembic migration is not applied.
>
> On local development box, running *gearbox migrate upgrade* is ok.
> But running with test.ini configuration - *gearbox migrate -c test.ini
> upgrade* returns the following output :
>
> (venv)root@ulysse:/tmp/tracim_repo/tracim# gearbox migrate -c test.ini
> upgrade
> 18:25:21,451 INFO  [alembic.migration] Context impl PostgresqlImpl.
> 18:25:21,451 INFO  [alembic.migration] Will assume transactional DDL.
>
> The patch is not applied.
>
> What is the way to apply alambic upgrade for test environment ?
>
> Note : according to the documentation -
> http://turbogears.readthedocs.org/en/latest/turbogears/migrations.html, I
> added to setup-app the following lines at the end of the setup_schema()
> function (the code is executed - I tested it with some debug printing) :
>
>
> import alembic.config, alembic.command
> alembic_cfg = alembic.config.Config()
> alembic_cfg.set_main_option("script_location", "migration")
> alembic_cfg.set_main_option("sqlalchemy.url", config['sqlalchemy.url'])
> alembic.command.stamp(alembic_cfg, "head")
>
> Note : I'm working with turbogears 2.4
>
> Thanks for your help
>
> Damien
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to